我想在我的 Angular 2 应用程序的两个单独的模块中包含一个共享组件“SimpleRadialChartComponent”。当我在每个模块的声明区域中传递此组件时,出现以下错误:
类型 SimpleRadialChartComponent 是 2 个模块声明的一部分
如何在两个不同的模块中声明共享组件?
最佳答案
好的做法是为两个或多个模块中使用的组件、模型对象等创建“共享”模块。
您可以在 official documentation 中找到所有指南和良好实践.
您的问题的详细描述,您可以找到here :
If you want to use a component across multiple modules, you'll need to create a "shared" module and add that component the shared module's exports. Then you add that shared module into your other modules imports.
关于angular - 类型 Y 是 2 个模块声明的一部分 - Angular 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43347640/