Angular 12 Datepicker
Asked Answered
M

1

10

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?

Mc answered 19/8, 2021 at 0:5 Comment(2)
You might want to try angular-mydatepicker by kekehBrittaney
Please provide your code so that others can determine the problem.Robinson
P
36
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.

Petr answered 27/8, 2021 at 18:34 Comment(3)
Could you add documentation citations on why these dependencies are required?Chinchin
Please add further details to expand on your answer, such as working code or documentation citations.Goodyear
This fixed my problem. And they still did not add it to the documentaion.Lashoh

© 2022 - 2024 — McMap. All rights reserved.