AngularJS Model Options Directive


The ngModelOptions directive gives control over how model updates behave. Specific events for when a model will update can be specified, effectively ignoring the unspecified events. The debounce property applies a delay to the model update, and handles the model resetting if changed before the specified timeout is reached. This functionality is ideal for a ‘keyup’ driven live search box, getting around the need to set up and clear your own $timeouts.

<input type="text" ng-model="search" ng-model-options="{ updateOn: 'default blur', debounce: { 'default': 500, 'blur': 0 } }" />

Other Resources