weixin_33693070 2016-04-12 16:13 采纳率: 0%
浏览 9

角度变量到PHP

i can't make it works. Could somebody help me? I would like to show user detail information after click on link, but i don't know how to send information to php file with a link.

i have link to detailed user information like:

<tr ng-repeat="user in users | filter:searchText | orderBy:'finish_date'">
          <td><a href="#/user/{{user.user_id}}">{{user.name + ' ' + user.lastname}}</a></td>
          <td> {{user.begin_date}}</td>
          <td> {{user.finish_date}}</td>
</tr>

and controller:

gymiControllers.controller('UserDetailCtrl', ['$scope', '$http',  function ($scope, $http) {
      console.log($scope.user.user_id);
      $http.get('php/UserDetailsGetData.php?user_id=user.user_id"').success(function(data) {
        $scope.user = data;
      });
    }]);

and php file, which should get variable from angular ;-):

$user_id = $_GET['user_id'];
  • 写回答

1条回答 默认 最新

  • weixin_33676492 2016-04-12 16:34
    关注

    Correct it to:

    gymiControllers.controller('UserDetailCtrl', ['$scope', '$http',  function ($scope, $http) {
          console.log($scope.user.user_id);
          $http.get('php/UserDetailsGetData.php?user_id='+$scope.user.user_id).success(function(data) {
            $scope.user = data;
          });
        }]);
    
    评论

报告相同问题?