ngModelOptions 的 angular 的 updateOn 属性支持的事件的完整列表是什么? [英] What is the complete list of events supported by angular's updateOn property of ngModelOptions?

查看:32
本文介绍了ngModelOptions 的 angular 的 updateOn 属性支持的事件的完整列表是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文档

updateOn:字符串,指定输入应该绑定到哪个事件.您可以使用空格分隔列表设置多个事件.有一个名为 default 的特殊事件,它与属于控件的默认事件相匹配.

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.

页面提到了几个事件:blurdefaultsubmit.还有其他人吗?完整列表是否记录在任何地方?

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

推荐答案

据我所知,您可以将任何可用的 DOM 事件绑定到 updateOn 属性.在此处查看完整列表.

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

查看 ngModel 的源代码,您可以看到传递给 updateOn 的选项将绑定到实际元素本身.

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

角度来源:

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

这篇关于ngModelOptions 的 angular 的 updateOn 属性支持的事件的完整列表是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆