模块加载顺序

时间:2020-09-28 11:05:49

标签: angular

AppModule:

Column(
   mainAxisAlignment: MainAxisAlignment.start,
   crossAxisAlignment: CrossAxisAlignment.start,
   children: [
      new Html(
         data: "<b>Hai</b>,
          defaultTextStyle: TextStyle(fontSize: 15),
       ),
     ],
)

对SharedModule和LayoutModule感兴趣

SharedModule有一个管道,我在LayoutModule中使用。管道在SharedModule中导出。但是我在布局中收到一个错误:错误:找不到管道'faIcon'!

2 个答案:

答案 0 :(得分:1)

导入到AppModule中的模块无法相互通信。它们仅向AppModule提供功能。如果将LayoutModule中的组件用于AppComponent中,则其上下文仅取决于LayoutModule:它不会选择来自AppModule导入的功能。

如果LayoutModule中的某些组件需要使用管道,则需要将SharedModule导入LayoutModule。

答案 1 :(得分:0)

您应将管道导入app.module.ts文件并将其添加到声明中。