AngularJS: How to execute a controller function AFTER completion of AJAX call in a service?
问题 Here's my code in the service. this.loginUser = function(checkUser) { Parse.User.logIn(checkUser.username, checkUser.password, { success: function(user) { $rootScope.$apply(function (){ $rootScope.currentUser = user; }); } }); }; Here's my code in the controller: $scope.logIn = function(){ authenticationService.loginUser($scope.checkUser); console.log($scope.currentUser) }; So, what I want to do is, execute some code AFTER the completion of AJAX call, whose success function sets the value of