두 개의 모듈이 있습니다 : ItemsListModule
및 SearchModule
.
ItemsListModule
wraps ItemsListComponent
및 SearchModule
wraps SearchComponent
.
ItemsList
페이지에서 항목 목록을 표시하는 데 사용되며 Search
결과 목록을 표시 하는데도 사용하고 싶습니다 . 즉 SearchComponent
, 내에서도 사용하고 싶습니다 ItemsListComponent
.
// SearchModule
@NgModule({
declarations: [SearchComponent],
imports: [SearchRoutingModule],
})
// ItemsListModule
@NgModule({
declarations: [ItemsListComponent],
imports: [],
})
// AppModule
@NgModule({
declarations: [AppComponent],
imports: [ItemsListModule, SearchModule],
})
그런 다음 의 템플릿 <my-items-list>
내에서 사용할 때 SearchComponent
구성 요소를 알 수 없다는 오류가 발생하고 해당 구성 요소가 SearchModule
. SearchModule
의 가져 오기에 추가 하면 동일한 오류 메시지가 나타납니다.
왜 ? ItemsList
검색 결과를 다시 표시하려면 어떻게해야 합니까? (앵귤러 8.3)
당신을 내보내기 ItemListComponent
로 ItemListModule
하고이 모듈을 가져SearchModule
SearchModule
@NgModule({
declarations: [SearchComponent],
imports: [SearchRoutingModule, ItemListModule],
})
ItemsListModule
@NgModule({
declarations: [ItemListComponent],
exports: [ItemListComponent]
})
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다