angularjs 登录中的类型错误不是函数
Type error in angularjs login is not a function
var myModule = angular.module("myModule",[]);
myModule.controller('addLoginController',函数($scope,$http,$log){
$scope.login() = function() {
$scope.user = $http({
method: 'POST',
url: 'http://127.0.0.1:8000/users',
data: {
email: $scope.email,
password:$scope.password
},
headers: {"Content-Type": 'application/json'}
})
.then(function(response){
$scope.userData = response.data;
$scope.status = response.status;
$scope.headers = response.headers;
$scope.config = response.config;
$log.console(response);
}, function (response) {
$scope.error = response.data;
alert("unsuccessful call");
});
}
});
这是函数表达式的正确语法(删除 ()):
$scope.login = function() {
...
}
var myModule = angular.module("myModule",[]);
myModule.controller('addLoginController',函数($scope,$http,$log){
$scope.login() = function() {
$scope.user = $http({
method: 'POST',
url: 'http://127.0.0.1:8000/users',
data: {
email: $scope.email,
password:$scope.password
},
headers: {"Content-Type": 'application/json'}
})
.then(function(response){
$scope.userData = response.data;
$scope.status = response.status;
$scope.headers = response.headers;
$scope.config = response.config;
$log.console(response);
}, function (response) {
$scope.error = response.data;
alert("unsuccessful call");
});
} });
这是函数表达式的正确语法(删除 ()):
$scope.login = function() {
...
}