angular.module("sportsStoreAdmin")
.constant("authUrl", "http://localhost:5500/users/login")
.controller("authCtrl", function($scope,$http,$location,authUrl){
$scope.authenticate = function (user, pass){
$http.post(authUrl,{
username: user,
password: pass
}, {
withCredentials:true
}).success(function (data){
$location.path("/main");
}).error(function (error){
$scope.authenticationError = error;
});
}
});
当我执行此代码时,我在控制台中有这个。
SyntaxError:at fromJson(/angular.js:1103:3) 在defaultHttpResponseTransform (/angular.js:8572:11)在匿名函数 (/angular.js:8517:5)atEach (/angular.js:335:11)在transformData (/angular.js:8516:3)在transformResponse (/angular.js:9224:11)在processQueue (/angular.js:12914:11)在匿名函数 (/angular.js:12930:27)at Scope.prototype。$ eval(/angular.js:14123:9)at Scope.prototype。$ digest(/angular.js:13939:15)
有什么问题? 我的$ http.post代码有什么问题吗?