Want to cancel an $http request in AngularJS? This feature was added to the 1.1.5 release via a timeout parameter:
1 2 3 4 5 | var canceler = $q.defer(); $http.get('/someUrl', {timeout: canceler.promise}).success(successCallback); // Aborts the $http request if it isn't finished. canceler.resolve(); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.