0
我有以下代碼,我將在GitHub上發佈。使用輸入輸出練習設置項目
我收到一個錯誤說:
Can't export directive ParentComponent from ParentModule as it was neither declared nor imported!
項目結構:
app.module.ts
@NgModule({
declarations: [],
imports: [
BrowserModule,
ChildModule,
ParentModule,
HomeModule
],
providers: [],
bootstrap: [HomeComponent]
})
export class AppModule { }
parent.ts
@NgModule({
declarations: [],
imports: [
CommonModule
],
exports: [ParentComponent ],
providers: [],
})
export class ParentModule { }
個
child.ts
@NgModule({
declarations: [
ChildComponent
],
imports: [
CommonModule
],
exports: [ChildComponent],
providers: [],
})
export class ChildModule {}
現在我多麼想成爲home
和默認頁面:你需要做兩件事declar和出口GitHub
最好的方法是將所有組件,管道,指令直接共享並在整個項目中共享 –