Input onchange with Angular2

你离开我真会死。 提交于 2020-01-05 06:26:09

问题


I try to detect on change with dart. Example html:

<div>
    <input id="photoUpload" type="file" name="photo" (onchange)="update()" multiple>
</div>

Dart:

@Component(
    selector: "photo-upload-dialog", templateUrl: "photo_upload_dialog.html")
class PhotoUploadDialog {


  update() async {
    print('Changed!');
  }
}

But nothing in a console.


回答1:


onChange is the default event handler name, not the event name.

Use instead

(change)="update()"


来源:https://stackoverflow.com/questions/38291410/input-onchange-with-angular2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!