I was looking at the Angular documentation for handling forms and found a very useful example for capturing the update in any field/control with a delay. Following is the sample code provided by Angularjs:
<input type="text" ng-model="user.name" ng-model-options="{ debounce: 250 }" /><br />
It works fine. But they mentioned that debounce
can be used with multiple events and provided another example like:
<input type="text" ng-model="user.name" ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }" /><br />
The problem with this example is that it always delay the updation whether you leave the field/control or not. Whereas in this case it should immediately update the model when user leave the field/control as debounce
is 0 in case of blur
.
Here is link for running example in Plunker.
Can anyone explain this behavior.