1
votes

HTML CODE

`<mat-form-field>
      <input type="file" (change)="onFileSelected($event)" name="categoryImage" >
 </mat-form-field>`

TS code

onFileSelected(event){
console.log(event);}

getting error even before operation mat-form-field must contain a MatFormFieldControl. at this line getMatFormFieldMissingControlError

1
<input matInput. Next time read the documentation carefully : material.angular.io/components/input/overview - user4676340
Input type "file" isn't supported by matInput. got this error after using matInput. - Lucifer
Then don't use a mat-form-field. - user4676340

1 Answers

1
votes

The <mat-form-field> doesn't support <input type="file" /> and as far as I can see there is nothing that supports it. Just remove the mat-form-field element entirely.

The form will still work without it.