找不到名称“MAT_DATE_LOCALE";使用 Material.angular 日期选择器 [英] Cannot find name "MAT_DATE_LOCALE" with Material.angular Datepicker
问题描述
根据文档https://material.angular.io/components/datepicker/overview 此处将区域设置代码设置为您希望通过放置
提供的区域设置代码提供者:[{提供:MAT_DATE_LOCALE,useValue:'en-GB'},]
但是我的应用程序无法编译,因为它告诉我它找不到名称 MAT_DATE_LOCALE.我是否在这里错过了一些东西,因为我必须自己定义它?不过,我想不出把它放在哪里,因为它都在模块类中.
在 Angular 9 中进行导入:
{ MAT_DATE_LOCALE } 来自@angular/material/core";
我想在导入时必须输入指定路径导入.优化的东西.
对不起我的英语.
<块引用>从 Angular 9 开始,不能通过@angular/material 导入任何组件.您将使用单独的辅助入口点,例如@angular/material/button.
According to the documentation https://material.angular.io/components/datepicker/overview here to set the locale code to one you want you provide it by putting
providers: [
{provide: MAT_DATE_LOCALE, useValue: 'en-GB'},
]
But then my app won't compile as it tells me it cannot find the name MAT_DATE_LOCALE. Am I missing something here as in I have to define it myself? Though, I can't think of where to put it as it's all in the module class.
In Angular 9 do the import:
{ MAT_DATE_LOCALE } from '@angular/material/core';
I suppose that in the import must be entered specified path import. Optimization stuff.
Sorry for my english.
From Angular 9, no component can be imported through @angular/material. You are to use the individual secondary entry-points, such as @angular/material/button.
这篇关于找不到名称“MAT_DATE_LOCALE";使用 Material.angular 日期选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!