How can I abort my pending ajax
requests in AngularJS
? I am using a Service
for making an ajax call and want to abort all pending requests if a new one is made on the same route.
Here is my service:
myService.service('angService', function($http){
this.getfromRemote=function(url){
return $http.get(location+'/dev/apiv-1-0-2/'+url);
}
});
Here I am calling the service. Before running next, I want to abort the pending ajax requests.
angService.getfromRemote('paymentStatement/'+$scope.username)
.success(function(response){
})