我想用角度材料对话框打开组件。
我写这段代码:
sendMessage(): void {
const dialogRef = this.matDialog.open(SendMessageComponent, {
data: {
requestRefId: this.requestId
},
panelClass: 'semd_message'
});
dialogRef.afterClosed().subscribe(res => {
if (res) {
this.FetchMessage();
}
});
}
但是当我想打开对话框时,它显示了这个错误:
No component factory found for SendMessageComponent. Did you add it to @NgModule.entryComponents?
at noComponentFactoryError (core.js:27401)
at CodegenComponentFactoryResolver.resolveComponentFactory (core.js:27477)
at CdkPortalOutlet.attachComponentPortal (portal.js:810)
at MatDialogContainer.attachComponentPortal (dialog.js:354)
at MatDialog._attachDialogContent (dialog.js:1161)
at MatDialog.open (dialog.js:1028)
at MessageComponent.sendMessage (message.component.ts:71)
at Object.handleEvent (message.component.html:3)
at handleEvent (core.js:45703)
at callWithDebugContext (core.js:47343)
declarations在我的模块中,我在, entryComponents,中定义了一个 SendMessageComponent exports。
@NgModule({
declarations: [ListComponent, SendMessageComponent],
imports: [
CommonModule,
BrowserAnimationsModule,
EMoneyDepositRoutingModule,
ReactiveFormsModule,
FormsModule ,
PageLayoutModule,
SecondaryToolbarModule,
TranslateModule.forChild(),
SharedModule,
CoreModule,
BreadcrumbsModule,
Angular2PromiseButtonModule.forRoot(promiseButtonConfig)
],
exports:[SendMessageComponent],
entryComponents: [SendMessageComponent]
})
export class EMoneyDepositModule { }
现在有什么问题?我该如何解决这个问题???
慕虎7371278
精慕HU
一只甜甜圈
相关分类