天天看點

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]
    //...
)