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.
<mat-form-field>? I mean something like that:</mat-form-field>and check if you have the[formGroup]="form"in your opening tag for form etc. Could you post the part of*.component.tsfor this? - k.vincent