Skip to content Skip to sidebar Skip to footer

Ngmodel On Input Type File

I'm trying to make a binding to an input field type file through ngModel on the typical Angular way like this: and fil

Solution 1:

You have to do it externally through (change) event

<input (change)="onFileChange($event)"type="file"id="fileUpload">

And access in the ts file like the below code

files: any[];

  onFileChange(event){
    this.files = event.target.files;
    console.log(event);
  }

Post a Comment for "Ngmodel On Input Type File"