我正在尝试在Angular 12中使用Material日期选择器,但出现错误:
main.js:1 错误 Error: Uncaught (in promise): TypeError: Cannot read property 'localeChanges' of null TypeError: Cannot read property 'localeChanges' of null
有没有其他日期选择器可以在Angular 12上正常工作的建议?
我正在尝试在Angular 12中使用Material日期选择器,但出现错误:
main.js:1 错误 Error: Uncaught (in promise): TypeError: Cannot read property 'localeChanges' of null TypeError: Cannot read property 'localeChanges' of null
有没有其他日期选择器可以在Angular 12上正常工作的建议?
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatNativeDateModule } from '@angular/material/core';
....
imports: [
MatInputModule,
MatDatepickerModule,
MatNativeDateModule
]
在您的app.module.ts中导入这两个模块
注意顺序,MatInputModule
应该在 MatDatepickerModule
之前导入。