MatDatepicker: No provider found for DateAdapter. You must import one of the following modules at your application root: MatNativeDateModule
I got, Here working fine Just import the modules in APP.MODULE.TS file
import {MatNativeDateModule} from '@angular/material/core';
imports: [
...
MatNativeDateModule
],
I've solved it by adding follow modules:
import {MatNativeDateModule} from '@angular/material';
import { MatMomentDateModule } from "@angular/material-moment-adapter";
and in your imports
imports: [
...
MatDatepickerModule,
MatButtonModule,
MatFormFieldModule,
MatNativeDateModule, MatMomentDateModule,
],
I'm not that deep in material-angular I've only follow the error message advice
ERROR Error: MatDatepicker: No provider found for DateAdapter. You must import one of the following modules at your application root: MatNativeDateModule, MatMomentDateModule, or provide a custom implementation.
Attention: For newer Angular versions you only need to import one module:
import { MatNativeDateModule } from '@angular/material/core';
...
imports: [
...
MatDatepickerModule,
MatButtonModule,
MatFormFieldModule,
MatNativeDateModule,
],
instead:
import {MatNativeDateModule} from '@angular/material';
import { MatMomentDateModule } from "@angular/material-moment-adapter";
...
imports: [
...
MatDatepickerModule,
MatButtonModule,
MatFormFieldModule,
MatNativeDateModule, MatMomentDateModule,
],
I just used the first import referred:
import {MatNativeDateModule} from '@angular/material';
the other import got me to another error I didn't solved, but it wasn't necessary.
Don't forget to add MatNativeDateModule to the imports array in app.module.ts.