ngModelOptions angular 的 updateOn 属性 支持的完整事件列表是什么?
What is the complete list of events supported by angular's updateOn property of ngModelOptions?
docs 说
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.
页面提到了一些事件:blur
、default
、submit
。还有其他的吗?完整列表是否记录在任何地方?
据我所知,您可以将任何可用的 DOM 事件绑定到 updateOn
属性。查看完整列表 here.
查看 ngModel
的源代码,您可以看到传递给 updateOn
的选项将绑定到实际元素本身。
https://github.com/angular/angular.js/blob/master/src/ng/directive/ngModel.js#L1188
Angular 来源:
if (modelCtrl.$options.getOption('updateOn')) {
element.on(modelCtrl.$options.getOption('updateOn'), function(ev) {
modelCtrl.$$debounceViewValueCommit(ev && ev.type);
});
}
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.
完整来源是 here。
docs 说
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.
页面提到了一些事件:blur
、default
、submit
。还有其他的吗?完整列表是否记录在任何地方?
据我所知,您可以将任何可用的 DOM 事件绑定到 updateOn
属性。查看完整列表 here.
查看 ngModel
的源代码,您可以看到传递给 updateOn
的选项将绑定到实际元素本身。
https://github.com/angular/angular.js/blob/master/src/ng/directive/ngModel.js#L1188
Angular 来源:
if (modelCtrl.$options.getOption('updateOn')) {
element.on(modelCtrl.$options.getOption('updateOn'), function(ev) {
modelCtrl.$$debounceViewValueCommit(ev && ev.type);
});
}
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.
完整来源是 here。