I have a requirement to fetch data through a web service for the search parameter which I type in a textbox. Currently it is working fine with debounce
in ng-model-options
and it fires a request after the time I specify.
I couldn't find that does angular cancel the previous incomplete request automatically once a new one is fired.
If not, how should I handle this as each key press will fire a request after the time period I specified.
The HTML is
<input type="text" class="form-control" name="inpTeachers" ng-model="inpTeachers" id="inpTeachers" autocomplete="off" required ng-change="GetTeachers(frmAddSubjectMain)" ng-model-options="{ updateOn: 'default blur', debounce: {'default': 500, 'blur': 0} }" placeholder="Ex. Nancy Chang" />
And the method GetTeachers
is just a simple method changing some scope variables after a http request.
Should I be cancelling the old http request if another ng-change
is fired.