AngularJS $state.go executes before previous statement execution completes
问题 I am using AngularJS, ui-router and $resource for RESTful webservices. A button in html view is clicked that calls below function i.e. $scope.login(). Consequently a REST service (through $resource) is called and returns a user in case user/pass are correct, $scope.login = function() { myfactory.get({ email: $scope.user.email, password: $scope.user.password },function(user) { accessmgr.grantAccess(user); //Line of interest - loi1 $state.go('app.dashboard-v1'); //Line of interest2 - loi2 },