天天看点

angular Meterial错误 Did you add it to @NgModule.entryComponents

在使用 MatDialogModule,引用dialog组件显示的时候报了如下错误:

RROR Error: No component factory found for DeleteDialogComponent. Did you add it to @NgModule.entryComponents?

官方的例子2个组件是写一起的,不牵扯到引用的问题。

最后查明原因,需要在 @NgModule 中加入:

@NgModule(
    //...
    entryComponents: [YourDialogComponent]
    //...
)