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?
[ngModelOptions]="{standalone: true}" checks all the checkbox for angular 6. 0.
The ng-model-options directive is used to control the binding of an HTML form element and a variable in the scope. You can specify that the binding should wait for a specific event to occur, or wait a specific number of milliseconds, and more, see the legal values listed in the parameter values below.
Model updates and validation By setting the allowInvalid property to true, the model will still be updated even if the value is invalid.
You can now control for a form (or single form elements) when the value or the validity is updated. This feature has been available in AngularJS 1.x but missed in Angular 2+ so far. The following update options can now be used in Angular 5 forms:
change: change is the default mode. By using this update option the form / form control is updated after every single change.
blur: the blur change mode is only updated the from values / validity status after a form control lost the focus.
submit: updates are only done after form submit.
Full source is here.
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);
});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With