Issue
I have a text field with ng-change event.Event should be called only when the user completed typing.How to delay calling the event?
<input type="text" ng-model="custname" ng-change="findCustName()">
Solution
You should use ng-blur
instead
A blur event fires when an element has lost focus.
<input type="text" ng-model="custname" ng-blur="findCustName()">
If you do not want to use ng-blur or lost focus, you can use the same ng-change with ng-model-options
As of Angular 1.3, you could use Angular ng-model-options directive
<input ng-change="findCustName()" ng-model-options="{debounce:1000}">
Answered By - Sajeetharan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.