使用Angular2输入onchange [英] Input onchange with Angular2
本文介绍了使用Angular2输入onchange的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试检测飞镖的变化.范例html:
I try to detect on change with dart. Example html:
<div>
<input id="photoUpload" type="file" name="photo" (onchange)="update()" multiple>
</div>
飞镖:
@Component(
selector: "photo-upload-dialog", templateUrl: "photo_upload_dialog.html")
class PhotoUploadDialog {
update() async {
print('Changed!');
}
}
但是控制台中什么也没有.
But nothing in a console.
推荐答案
onChange
是默认的事件处理程序名称,而不是事件名称.
onChange
is the default event handler name, not the event name.
改为使用
(change)="update()"
这篇关于使用Angular2输入onchange的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文