Angular 导入子模块导致父模块的组件损坏

问题描述

我有一个 carModule 包含两个组件 carcar-detail。我需要在 wheel 组件中使用另一个名为 wheelModule 的模块中的另一个名为 car-detail 的组件。

我正在导出 wheelComponent 中的 wheel.module.ts,然后在 wheelModule 文件添加 car.module.ts(在 imports@NgModule 部分).

现在我可以访问 wheel 中的 <wheelDetail></wheelDetail> 组件 HTML 标记 (car-detail.component.html) 并且它工作正常。

问题是现在,名为 car 的主要 car.component.html 组件损坏并显示 wheel 组件的内容而不是 car 组件的内容!!!

/vehicle/car/

car-detail.component.html
car-detail.component.ts
car.component.html
car.component.ts
car.modules.ts

/vehicle/wheel/

wheel.component.html
wheel.component.ts
wheel.modules.ts

知道如何修复它吗?

wheel.module.ts

@NgModule({
      declarations: [
        wheelComponent
      ],imports: [
        ...,DxPopupModule,...
      ],exports: [
        wheelComponent
      ]
})

car.module.ts

@NgModule({
      declarations: [
        carComponent,carDetailComponent
      ],wheelModule,]
})

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)