I have this:
<input type="file" class="d-none" (change)="onPhotoSelected($event)" #photoInput>
and on my component.ts:
onPhotoSelected(event: HtmlInputEvent): void {
if (event.target.files && event.target.files[0]) {
this.file = <File>event.target.files[0];
// image preview
const reader = new FileReader();
reader.onload = e => this.photoSelected = reader.result;
reader.readAsDataURL(this.file);
}
}
but I'm getting this issue:
Error: src/app/components/photo-form/photo-form.component.html:15:77 - error TS2345: Argument of type 'Event' is not assignable to parameter of type 'HtmlInputEvent'.
why??
I'm working with angular with typescript