Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

error NG8002: Can't bind to 'matDatepicker' since it isn't a known property of 'input'

I am implementing an application using Angular 15. I use Angular Material there. I need to add a date picker and after inserting the code snippet below I’m getting an error.

<mat-form-field appearance="outline">
        <mat-label>Choose a date</mat-label>
      <input formControlName="freshness" matInput [matDatepicker]="picker">
        <mat-datepicker-toggle matIconSuffix [for]="picker"></mat-datepicker-toggle>
        <mat-datepicker #picker></mat-datepicker>
    </mat-form-field>

Error:

Error: src/app/dialog/dialog.component.html:18:51 - error NG8002: Can't bind to 'matDatepicker' since it isn't a known property of 'input'.

18       <input formControlName="freshness" matInput [matDatepicker]="picker">

If you need further information to solve my issue please put a comment here.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

The following modules should be imported into your component if it’s a standalone component (otherwise, in your module imports):

Besides, make sure you also import the MatInputModule and MatFormFieldModule to make them work.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading