I have used mat-date-picker
inside my application, the html file looks like this :
<mat-form-field>
<input matInput [matDatepicker]="picker" formControlName="date" placeholder="Choose a date">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
I have used the exact same piece of code in my another component and it works, but in this component it displays the error:
ERROR Error: mat-form-field must contain a MatFormFieldControl.
Even though the page is loading after the error, the button of date picker doesnot get displayed and i cannot select a date.
Make sure you've imported the module MatInputModule
.