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

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?