问题
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