I am trying to add File type input in angular material form but I am getting error as mat-form-field must contain a MatFormFieldControl.
I tried adding matInput in the input tag then too I am getting error as mat-form-field must contain a MatFormFieldControl what are ways to add file upload type input inside the angular material form?
<mat-sidenav-container>
<mat-sidenav-content>
<form>
<mat-form-field appearance="outline">
<mat-label>Media Title</mat-label>
<input matInput placeholder="Enter your name">
</mat-form-field>
<mat-form-field>
<button type="button" mat-raised-button (click)="fileInput.click()">Choose File</button>
<input hidden (change)="onFileSelected()" #fileInput type="file" id="file">
</mat-form-field>
</form>
</mat-sidenav-content>
</mat-sidenav-container>
app.module.ts
import { AngularMaterialModule } from './material.module';
import { MatInputModule, MatFormFieldModule } from '@angular/material';
imports: [
BrowserModule,
BrowserAnimationsModule,
AngularMaterialModule,
MatInputModule,
MatFormFieldModule
],
File Upload input should be added inside the form.
