asp.net mvc - Force Angular function to complete -
i have angular function contained within angular controller on login page supposed set localstorage
values
here function
$scope.setinfo = function () { getinfo.getfromserver($scope.username, $scope.password).then(function(response) { console.log("got here!"); localstorage["yat"] = response.data.access_token; localstorage["yrt"] = response.data.refresh_token; }, function() { console.log("error occured"); }); }
the function executed on ng-click
event of login button posting mvc controller
authenticate user , redirect landing page. when looking @ console.log("got here!");
statement can see not reached, getinfo.getfromserver
method never called, when restarting application in visual studio, can see statement reached.
will redirect of mvc controller have affect on completion of angular function, or might possible application redirected before angular function got chance execute method?
is there way make sure method executed?
Comments
Post a Comment