angular - when using [(ngModel)] directive, what is the event expression called to detect change?
问题描述
Using [(ngModel)]="value" directive inside an Input control which is rendered as a range slider. The two-way binding side of this works nicely, but I would like to be able to fire off some code when the value changes.
What expression/function name should I use with this form of ngModel binding? Documentation doesn't seem to indicate this unless I'm missing something.
解决方案
您可以收听值更改(ngModelChange)
时调用的事件。ngModel
(ngModelChange)="takeAction()"
-
takeAction() {
// called invoke when value of `ngModel` Changes
}
推荐阅读
- flutter - 添加 POST/GET 方法时如何正确生成 .g.dart 文件?
- ios - 我刚刚推出了世博反应原生应用程序。如何通过 xcode 运行应用程序?
- bluetooth-lowenergy - 这是什么时间码?(可能具体)
- django-rest-framework - 如何使用 django rest 框架上传多张图片?
- java - 如何提高 GroovyClassLoader.loadClass 的性能?
- json - 'get' 请求的返回形式。在以 json 形式编写的网站中获取信息
- .net - 如何使用反射查找和注册依赖项
- python - Python:使用正则表达式或逻辑删除列表中的少量字符串内容
- c++ - 返回左值的函数,总是返回左值引用
- c# - WCF 客户端处于开发模式以及发布给具有不同 IP 地址的用户时