角材料在子模块上不起作用

时间:2019-05-15 17:38:20

标签: angular angular-material subcomponent

我有一个Angular材质模块,其中包含我在应用程序中使用的所有功能。

enter image description here

我正在将此模块导入AppModule。 enter image description here

您可以在图像上看到,我还有另外两个名为“ LayoutModule”和“ SharedModule”的模块,这两个模块都使用了材质组件。这里的问题是,如果我尝试运行该应用程序,则会收到一条错误消息,提示“材料组件”不是已知元素。

enter image description here

将MaterialModule导入这两个模块可以消除错误,但是在那种情况下,我看不出在我的“ AppModule”上使用“ MaterialModule”的原因。

1 个答案:

答案 0 :(得分:0)

您需要将子模块导入app.module.ts