我的结构是这样的:
|_ app.module.ts
|_ app.component.ts
|_ admin
| |_ admin.module.ts
| |_ admin.component.ts
| |_ admin.component.html
| |_ org-tree
| |_ org-tree.component.ts
| |_ org-tree.component.html
| |_ org-edit
| |_ org-edit.component.ts
| |_ org-edit.component.html
| |_ org-delete-dialog
| |_ org-delete-dialog.component.ts
| |_ org-delete-dialog.component.html
org-tree 显示组织的分层列表。单击其中任何一个打开编辑对话框
this.windowService.open(OrgEditComponent, { title: `Edit`, context: { organisation: org } });
此窗口包含一个带有保存和删除按钮的表单。删除按钮附加到以下内容:
this.dialogService.open(OrgDeleteDialogComponent, {
context: {
organisation: this.organisation
},
closeOnBackdropClick: false,
});
单击此按钮会出现以下错误:
ERROR Error: No component factory found for OrgDeleteDialogComponent. Did you add it to @NgModule.entryComponents? OrgEditComponent.html:138
at noComponentFactoryError (core.js:19453)
at CodegenComponentFactoryResolver.resolveComponentFactory (core.js:19504)
at NbPortalOutletDirective.attachComponentPortal (portal.js:506)
at NbDialogContainerComponent.attachComponentPortal (index.js:17947)
at NbDialogService.createContent (index.js:18156)
at NbDialogService.open (index.js:18114)
at OrganisationEditComponent.confirmDeleteOrg (organisations-edit.component.ts:43)
at Object.eval [as handleEvent] (OrganisationEditComponent.html:141)
at handleEvent (core.js:34777)
at callWithDebugContext (core.js:36395)
管理模块是:
@NgModule({
imports: [
CommonModule,
FormsModule,
NbCardModule,
ThemeModule,
NbTreeGridModule,
NbButtonModule,
NbInputModule,
NbIconModule,
NbWindowModule.forChild(),
NbDialogModule.forChild(),
],
declarations: [
AdminComponent,
OrgTreeComponent,
OrgDeleteDialogComponent,
OrgEditComponent,
FsIconComponent,
],
entryComponents: [
OrgDeleteDialogComponent,
OrgEditComponent,
]
})
export class AdminModule { }
如果我在 org-tree-component 上放置一个打开 org-delete-dialog 的按钮,它可以正常打开,所以我猜这与 Window 组件打开 Dialog 组件有关。
我需要添加什么才能完成这项工作?
谢谢。