components: Getting "No component factory" error while opening a Material Dialog in lazy loaded Component
Hi,
Im getting the following error when i try to open Material Dialog in ConfirmBoxComponent
.
No component factory found for ConfirmBoxComponent. Did you add it to @NgModule.entryComponents?
I have already added ConfirmBoxComponent in entryComponents list
declarations: [
ConfirmBoxComponent
],
exports: [ConfirmBoxComponent],
entryComponents: [
ConfirmBoxComponent
],
The module that contain ConfirmBoxComponent is loaded via Lazy loading technique.
I’m not sure this is bug or not.
I’m using latest version of Angular and Material
"@angular/core": "^5.0.0",
"@angular/material": "^5.0.0-rc0"
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 19 (3 by maintainers)
You need to import
MatDialogModule
inConsumerModule
in order for it to know about theentryComponents
thereIn regards to Angular v6+: in case anyone is using the
MatDialog
service inside another injectable service and is using the{ providedIn: 'root' }
option for that service, you’ll need to instead provide that service in theproviders
array of the module where your dialog components are declared.Is this still the solution for this issue? Or has something else changed as of late?
I can’t seam to get this to work, this is basically the exact same setup I got, but only getting:
No component factory found for LoginDialogComponent