数据未通过angularjs填入名称字段

时间:2016-12-10 11:53:37

标签: javascript jquery angularjs http get

Hello Everyone我通过Angular ajax调用获取数据 这是电话

 $scope.EditOperator = function ($event) {
    $event.stopPropagation();
    var ID = $scope.idSelectedOperator;
    $http.post('/api/privilege/editopap/' + $scope.idSelectedOperator)
        .success(function (data, status) {
            $scope.Operator=data;
            $scope.Operator.Name = data.name;
            alert($scope.Operator.Name)
            $scope.Operator.Password = $scope.EditOperator.name;
            $scope.Operator.Email = data.email;
            $scope.$applyAsync();
            toastr.success("Update Successfully");

        }).error(function () {
            toastr.error("Something went wrong");

        });
};

我正在获取我想要的数据,但是当我尝试在

中分配数据时
 $scope.Operator.Name = data.name;

然后它在控制台中显示未定义。 这里我得到的数据是

**email:"gaurav1verve@gmail.com"
id:0
name:"Gaurav"
password:"tyh"**

和$ scope.Operator是一个包含三个字段的对象

 $scope.Operator = {
    Password: '',
    Email: '',

    Name: ''
};

0 个答案:

没有答案