【发布时间】:2018-11-20 08:21:43
【问题描述】:
我正在尝试将“OpenDialogContentComponent”组件从模块 A 导入到模块 B,但出现错误:
'无法确定 C:/Users/jitdagar/Desktop/TDP/pwt-ui-common/src/app/components/open-dialog-content/open-dialog-content 中类 OpenDialogContentComponent 的模块。组件.ts!将 OpenDialogContentComponent 添加到 NgModule 以修复它。'
这个 OpenDialogContentComponent 组件在模块 A 中导出,并且可以在模块 B 中使用它的选择器。但我的要求是使用 import 语句导入组件。
在模块 B 的组件中:
从 '../../../../Module A/src/app/components/open-dialog-content/open-dialog-content.component' 导入 { OpenDialogContentComponent }; em>
【问题讨论】:
-
你需要在 ModuleB 的导入下添加你的 ModuleA
-
模块已经添加,这就是为什么我可以在模块 B 中使用模块 A 的组件的选择器。我想通过导入在路由中使用该组件。
-
模块 A 可以被视为共享模块,组件“OpenDialogContentComponent”是我想在模块 B 路由中使用的共享组件。
-
对于那些投反对票的人,请澄清问题是否不清楚/无效/的原因。我想我用答案澄清了我的问题。
标签: angular typescript frontend