8

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?

Rodrigo
  • 91
  • 1
  • 2

1 Answers1

28
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.

Naveed Ahmed
  • 10,048
  • 12
  • 46
  • 85
Gaurav kumar
  • 281
  • 2
  • 4