I am using angularjs 1.5 and while using md-autocomplete with $http request to fetch the list if i press enter key when some http calls are in pending state then all the pending requests are getting cancelled automatically.
here is my code snippet:
HTML:
<md-autocomplete md-selected-item="selectedItem" md-search-text="searchText" md-items="item in querySearch(searchText)">
<md-item-template>
<span md-highlight-text="searchText">{{item}}</span>
</md-item-template>
</md-autocomplete>
JS:
function querySearch (searchText) {
return $http
.get(BACKEND_URL + '/items/' + searchText)
.then(function(data) {
// Map the response object to the data object.
return data;
});
}