Reputation: 29
I've been having a problem, and the simplest solution in my mind is to get what is described in my title to work; a full resolution of a function before the href navigation. Is this possible?
More info - I'm trying to submit form data and open an sms with the same button. Opening the sms works without the ng-click, but once I try to execute a function, only the function is resolved.
Upvotes: 1
Views: 555
Reputation: 4861
You could navigate to the new page from the controller instead of the ng-click. This way you can way for your promise to resolve before redirecting to the new page using $location
<a href="" ng-click="myFunc()">Link</a>
Your controller
$scope.myFunc = function() {
// sample promise
$http.get().then(resp) {
// once promise is resolved, navigate to new page
$location.path('path/to/sms')
}
}
Upvotes: 1