Rodrigo
Rodrigo

Reputation: 111

Angular 12 Datepicker

I am trying to use material datepicker in Angular 12, but having error:

main.js:1 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'localeChanges' of null TypeError: Cannot read property 'localeChanges' of null

Any suggestion about other datepicker working fine on angular 12?

Upvotes: 10

Views: 7757

Answers (1)

Gaurav kumar
Gaurav kumar

Reputation: 371

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

....

imports: [
   MatInputModule,
   MatDatepickerModule,
   MatNativeDateModule
]

import these two in your app.module.ts

The order matters here, MatInputModule should be imported before MatDatepickerModule.

Upvotes: 37

Related Questions