这是我的角度模块结构...
Landing.module.ts
@NgModule({
declarations: [LandingComponent],
imports: [CommonModule, HeadersidebarModule, LandingRoutingModule
],
})
Landing.component.html
<app-header></app-header>
HeaderSidebar.moduele.ts
@NgModule({
imports: [
RouterModule, MatProgressBarModule, NotificationsModule
],
declarations: [
HeaderComponent, SidebarComponent
],
exports: [HeaderComponent, SidebarComponent]
})
header.component.html
<app-notifications></app-notifications>
Notifications.module.ts
@NgModule({
declarations: [NotificationsComponent, NotificationsListComponent],
imports: [
CommonModule, MatBadgeModule, MatIconModule,
],
exports: [NotificationsComponent],
entryComponents: [NotificationsListComponent],
})
Notifications.component.ts 试图动态地加载notificationlist.component.ts,并在Notification.module.ts的@NgModule()的entrycomponents数组中提及notificationlistcomponent,但仍然收到错误,
请帮助...
错误是->
错误错误:找不到用于的组件工厂 NotificationsListComponent。您是否将其添加到 @ NgModule.entryComponents? 在noComponentFactoryError(core.js:7754) 在CodegenComponentFactoryResolver.push ../ node_modules/@angular/core/fesm5/core.js.CodegenComponentFactoryResolver.resolveComponentFactory中 (core.js:7792) 在DomPortalOutlet.push ../ node_modules/@angular/cdk/esm5/portal.es5.js.DomPortalOutlet.attachComponentPortal (portal.es5.js:409) 在DomPortalOutlet.push ../ node_modules/@angular/cdk/esm5/portal.es5.js.BasePortalOutlet.attach (portal.es5.js:296) 在OverlayRef.push ../ node_modules/@angular/cdk/esm5/overlay.es5.js.OverlayRef.attach (overlay.es5.js:995) 在OverlayService.push ../ src / app / shared / services / overlay_.service.ts.OverlayService.open (overlay_.service.ts:63) 在NotificationsComponent.push ../ src / app / shared / notifications / notifications.component.ts.NotificationsComponent.openNotnListOverlay处 (notifications.component.ts:41) 在Object.eval [作为handleEvent](NotificationsComponent.html:2) 在handleEvent(core.js:19545) 在callWithDebugContext(core.js:20639)