No component factory found for DynamicDialogComponent
Posted: 08 Jan 2019, 21:31
I have a feature module (which is not app module), where I am trying to define a dynamic dialog. I am using Angular 7.2.0 and PrimeNG 7.0.4.
I created a Component called BadgeComponent.
I have updated my module to import BadgeComponent. I added BadgeComponent to the declarations, entryComponents and exports.
The calling component has imported { DialogService } from 'primeng/api'; along with the BadgeComponent.
The dialog is triggered with this code:
const ref = this.dialogService.open(BadgeComponent, {
header: 'Print Badge',
width: '35%',
contentStyle: {"max-height": "350px", "overflow": "auto"}
});
Everything compiles and when I trigger the dialog to appear I get a message:
ERROR Error: No component factory found for DynamicDialogComponent. Did you add it to @NgModule.entryComponents?
at noComponentFactoryError (VM1500 vendor.js:19396)
at CodegenComponentFactoryResolver.push../node_modules/@angular/core/fesm5/core.js.CodegenComponentFactoryResolver.resolveComponentFactory (VM1500 vendor.js:19434)
at DialogService.push../node_modules/primeng/components/dynamicdialog/dialogservice.js.DialogService.appendDialogComponentToBody (VM1500 vendor.js:85551)
at DialogService.push../node_modules/primeng/components/dynamicdialog/dialogservice.js.DialogService.open (VM1500 vendor.js:85537)
I tried a lot of different combinations but can't get this to work. Could someone shed some light on what I might be doing incorrectly?
Thanks!
Dave
I created a Component called BadgeComponent.
I have updated my module to import BadgeComponent. I added BadgeComponent to the declarations, entryComponents and exports.
The calling component has imported { DialogService } from 'primeng/api'; along with the BadgeComponent.
The dialog is triggered with this code:
const ref = this.dialogService.open(BadgeComponent, {
header: 'Print Badge',
width: '35%',
contentStyle: {"max-height": "350px", "overflow": "auto"}
});
Everything compiles and when I trigger the dialog to appear I get a message:
ERROR Error: No component factory found for DynamicDialogComponent. Did you add it to @NgModule.entryComponents?
at noComponentFactoryError (VM1500 vendor.js:19396)
at CodegenComponentFactoryResolver.push../node_modules/@angular/core/fesm5/core.js.CodegenComponentFactoryResolver.resolveComponentFactory (VM1500 vendor.js:19434)
at DialogService.push../node_modules/primeng/components/dynamicdialog/dialogservice.js.DialogService.appendDialogComponentToBody (VM1500 vendor.js:85551)
at DialogService.push../node_modules/primeng/components/dynamicdialog/dialogservice.js.DialogService.open (VM1500 vendor.js:85537)
I tried a lot of different combinations but can't get this to work. Could someone shed some light on what I might be doing incorrectly?
Thanks!
Dave