Angular material: MatDatepicker: No provider found for DateAdapter

Discussão em 'Angular' iniciado por ajgisme, Novembro 27, 2024.

  1. ajgisme

    ajgisme Guest

    I'm trying to use the Datepicker component in Angular Material. Here is my HTML code:

    <input matInput [matDatepicker]="picker" placeholder="Choose a date" disabled>
    <mat-datepicker #picker disabled="false"></mat-datepicker>


    However, it's not working for me and I'm getting the following error:


    Error: MatDatepicker: No provider found for DateAdapter.
    ​

    The error message tells me that I need to import MatNativeDateModule as well as MatDatepickerModule but I have done that. Here is my import code below from app.module.ts:

    import {
    MatFormFieldModule,
    MatMenuModule,
    MatCheckboxModule,
    MatIconModule,
    MatDatepickerModule,
    MatNativeDateModule
    } from '@angular/material';


    Is there anything else I'm missing?

    Continue reading...

Compartilhe esta Página