Search code examples
javascriptangularjsangular-ngmodel

What is the complete list of events supported by angular's updateOn property of ngModelOptions?


The docs say

updateOn: string specifying which event should the input be bound to. You can set several events using an space delimited list. There is a special event called default that matches the default events belonging of the control.

The page mentions a few events: blur, default, submit. Are there any others? Is the full list documented anywhere?


Solution

  • As far as i know, you can bind any available DOM event to the updateOn property. see a full list here.

    Having a look at the Source of ngModel, you can see that the options passed to updateOn will get bound to the actual element itself.

    https://github.com/angular/angular.js/blob/master/src/ng/directive/ngModel.js#L1188

    Angular Source:

    if (modelCtrl.$options.getOption('updateOn')) {
      element.on(modelCtrl.$options.getOption('updateOn'), function(ev) {
        modelCtrl.$$debounceViewValueCommit(ev && ev.type);
      });
    }