In my Angular app i have a module called MaterialModule
that includes the following content:
imports: [
MatDialogModule,
...
],
exports: [
MatDialogModule,
...
]
It is exported in a module called SharedModule
:
@NgModule({
imports: [
MaterialModule,
...
],
exports: [
MaterialModule,
...
]
})
export class SharedModule { }
I would like to show a dialog from one of my lazy loaded components, so in my lazy loaded module i import this SharedModule
and add the dialog component as an entry component:
@NgModule({
declarations: [
MyLazyLoadedComponent,
MyDialogComponent,
...
],
imports: [
CommonModule,
SharedModule,
...
],
entryComponents: [MyDialogComponent]
})
export class MyLazyLoadedModule { }
But whenever i try to open the dialog from MyLazyLoadedComponent
, i get the following error message:
No component factory found for MyDialogComponent. Did you add it to @NgModule.entryComponents?
Opening dialogs from components that are not lazy loaded works fine.
I'd really appreciate any advice on what could be wrong with my configuration.