Angular Material: MatDatepicker: No Provider Found For DateAdapter


Answer :

You need to import both MatDatepickerModule and MatNativeDateModule under imports and add MatDatepickerModule under providers

 imports: [     MatDatepickerModule,     MatNativeDateModule    ],   providers: [       MatDatepickerModule,     ], 

Angullar 8,9

import { MatDatepickerModule } from '@angular/material/datepicker'; import { MatNativeDateModule } from '@angular/material/core'; 

Angular 7 and below

import { MatDatepickerModule, MatNativeDateModule } from '@angular/material'; 

You need to import both MatDatepickerModule and MatNativeDateModule under imports and add MatDatepickerModule under providers

imports: [     MatDatepickerModule,     MatNativeDateModule    ],   providers: [       MatDatepickerModule,     MatNativeDateModule     ], 

Just import the

MatNativeDateModule

along with the

MatDatepickerModule

at the app.module.ts or app-routing.module.ts.

@NgModule({ imports: [     MatDatepickerModule,     MatNativeDateModule  ] }) 

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable