Trying to cancel an $http request on a search input box but the prior requests don't seem to be getting aborted. I followed the example from other stack overflow questions. Here is my JS code:
var canceler;
$scope.someFunction = function() {
if(canceler)
canceler.resolve();
canceler = $q.defer();
$http({method: 'GET', url: service+url, timeout: canceler.promise}).
success(function(data, status, headers, config) { });
}
HTML:
<input ng-change="someFunction" />
If I enter two characters into the search box the function is called twice but the initial request still goes through. So both requests end up going through and pending on the response time it is random which response is being used. Did the library change at some point? I had this working awhile ago but now it no longer is working.