-1
私は角度サービスからコールバックを取得しようとしていますが、コールバック関数は機能しません。ここでhttpポストコールバックが作動していない角度ファクトリ
マイコントローラのコードである: - :
mainApp.service('AuthenticationService',function($http,$cookieStore,$rootScope){
var service = {};
service.Login = function (username, password, callback) {
$http({
method: "POST",
//headers: {'Content-Type': 'application/x-www-form-urlencoded'},
url: 'users/authenticate',
data: {email: username,password:password}
})
.success(callback);
};
return service;
});
どちらも私は、コンソールで応答を取得 -
$scope.uu = "hello" // this i just make for test
$scope.login = function(user){
//console.log(user)
AuthenticationService.Login(user.username,user.password).success(function(data){
console.log(data);
$scope.uu = data;
})
}
私のサービスコードではありません。スコープは変更されません。 私はこの質問に言及しましたが、答えは私のために働いていません。あなたがサービスを作成している場合 $http POST response from service to controller
API呼び出しの間にどのようなエラーが発生しているかを確認します。 –
apiから正しい応答が得られました。 APIは応答しています。 –
コントローラでも動作しないconsole.log( 'test')を記述しても、コールバックだけが機能しません –