用于另一个模块的导出组件

问题描述 投票:0回答:1

我有两个模块,我想使用另一个CommonSharedModule模块中的PrivateModule模块中的组件

当我在模块中使用选择器时出现此错误

如果'product-information'是Angular组件,请验证它是此模块的一部分。

CommonSharedModule

const MODULE_COMPONENT = [
  ProductInformationComponent
];

@NgModule({
  declarations: MODULE_COMPONENT,
  imports: [
    CommonModule
  ],
  exports: MODULE_COMPONENT
})
export class CommonSharedModule { }

PrivateModule

const MODULE_COMPONENT = [
  PrivateComponent
];

@NgModule({
  declarations: MODULE_COMPONENT,
  imports: [
    CommonModule,
    LayoutModule,
    ProductModule,
    PrivateRoutingModule,
    CommonSharedModule
  ]
})
export class PrivateModule { }
javascript angular typescript angular-module
1个回答
-1
投票
product-information同时添加到declarationsexportsCommonSharedModule数组中>
© www.soinside.com 2019 - 2024. All rights reserved.