简体   繁体   English

如何在angular 2中嵌套不同的模块

[英]How to nest different modules in angular 2

The app.module has the admin-layout.module.
The admin-layout.module has the parameters.module.
The parameters.module has the soa-date.Component.
But the property.component is in the admin-layout.module

I need to put the <app-soa-date></app-soa-date> selector in the property.component but it gives me an error of app-soa-date is not a known element.我需要将<app-soa-date></app-soa-date>选择器放在 property.component 中,但它给了我一个错误 app-soa-date is not a known element。

<div class="card-body">
  <div *ngIf="showSoaDate">
    <app-soa-date></app-soa-date>
  </div>
  <div *ngIf="showOther">
    Other
  </div>
</div>

Please see the image below:请看下图: 在此处输入图片说明

Thank you.谢谢你。

You need to export SoaDateComponent component from your ParametersModule .您需要从ParametersModule导出SoaDateComponent组件。

exports: [
  SoaDateComponent
] 

You need to export the component too in your ParamatersModule您也需要在 ParamatersModule 中导出组件

declarations: [
....
],
exports: [
  SoaDateComponent 
]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM