Lucifer
Lucifer

Reputation: 626

mat-form-field must contain a MatFormFieldControl. at getMatFormFieldMissingControlError

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

Upvotes: 1

Views: 4734

Answers (1)

Kirzy
Kirzy

Reputation: 148

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.

Upvotes: 1

Related Questions