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
No component factory found for DynamicDialogComponent
-
- Posts: 449
- Joined: 08 Aug 2018, 14:09
Hi,
Did you add DialogService provider in your main component ?
Did you add DialogService provider in your main component ?
Code: Select all
@Component({
templateUrl: './dynamicdialogdemo.html',
providers: [DialogService, MessageService]
})
export class DynamicDialogDemo {
constructor(public dialogService: DialogService, public messageService: MessageService) {}
show() {
const ref = this.dialogService.open(CarsListDemo, {
header: 'Choose a Car',
width: '70%',
contentStyle: {"max-height": "350px", "overflow": "auto"}
});
ref.onClose.subscribe((car: Car) =>{
if (car) {
this.messageService.add({severity:'info', summary: 'Car Selected', detail:'Vin:' + car.vin});
}
});
}
}
-
- Posts: 449
- Joined: 08 Aug 2018, 14:09
Hi can i see your code ?
Did you ever figure this one out? Sitting with a similar issue. Have added as
Code: Select all
declarations and entryComponents
i face this when i create this sample ,
see inside its resolved
https://stackblitz.com/edit/angular-1ri ... onent.html
see inside its resolved
https://stackblitz.com/edit/angular-1ri ... onent.html
-
- Information
-
Who is online
Users browsing this forum: No registered users and 7 guests