Error: No component factory found for DynamicDialogComponent. Did you add it to @NgModule.entryComponents

UI Components for Angular
Post Reply
Withnail73
Posts: 7
Joined: 01 Nov 2019, 18:32

23 Feb 2021, 19:10

Hey there. This is a weird one. I have application that was written in Angular 8 using Prime 8 - it's been running fine for more than a year now.

I have just migrated the Angular to 11, but can't afford to do the same to the Prime at the moment since it would be too much work to adjust the look and feel changes. So that's still on 8. Everything appears to work fine except the modal dialogs that have embedded components. As soon as the DialogService.open() is triggered it throws:

Code: Select all

Error: No component factory found for DynamicDialogComponent. Did you add it to @NgModule.entryComponents?
This is not my own component, ie: I've not forgotten to add them to the module's entryComponents array.

If I add this component (primeng/components/dynamicdialog/dynamicdialog) to the module in Declarations and entryComponents, it will get a little further but then crashes trying to pull values (that don't exist) from the DynamicDialogRef:

Code: Select all

ERROR TypeError: Cannot read property 'viewContainerRef' of undefined
    at DynamicDialogComponent.push.2bbZ.DynamicDialogComponent.loadChildComponent (dynamicdialog.js:41)
    at DynamicDialogComponent.push.2bbZ.DynamicDialogComponent.ngAfterViewInit (dynamicdialog.js:30)
I'm hoping this doesn't mean I will be forced to move to Prime 11 - can someone explain what is happening?

Thanks!

Withnail73
Posts: 7
Joined: 01 Nov 2019, 18:32

24 Feb 2021, 14:40

Ok... so worked out it was related to the Ivy compilation which I disabled in order for the v8 Prime comps to build correctly. But, it seems the entryComponents array is still being ignored as all my dynamic components are not defined. Will continue the google-fest...

Withnail73
Posts: 7
Joined: 01 Nov 2019, 18:32

25 Feb 2021, 18:10

Problem resolved and I'm ashamed to say it was a silly one! Somehow (probably during the initial Prime migration to 11) the DynamicDialogModule had been removed from all modules:

Code: Select all

import { DynamicDialogModule } from 'primeng/dynamicdialog';
Added it back everywhere and the problem's gone. I'll get my coat.... :oops:

Mo_Ay
Posts: 2
Joined: 14 Jul 2021, 14:58

14 Jul 2021, 15:47

i have a similar problem where i have this error using primeng 9.1.2 (in angular9):

Code: Select all

ERROR in ./src/app/app.module.ngfactory.js
Module not found: Error: Can't resolve '../../node_modules/primeng/dynamicdialog/primeng dynamicdialog.ngfactory' in 'Path...'
While i have this import in module.ts:

Code: Select all

import { DynamicDialogModule } from 'primeng/dynamicdialog';
@NgModule({
    imports: [...
    DynamicDialogModule,
    ...]
have any one an advice ? (or even better, a solution ;) )

redley112
Posts: 1
Joined: 05 Jan 2022, 05:44

05 Jan 2022, 05:49

Hi! I am using Prime Ui for my RestFul web service app. I have a data table and when I click on a row, a dialog pops up with a form that contains the table row binding and a button to submit when I edit it. Now after submitting, I only need to update the table, I will go crazy but it still doesn't work.
slope unblocked

jordanlaris
Posts: 1
Joined: 12 Oct 2022, 03:45

18 Oct 2022, 04:13

Looks like DynamicDialogModule has been removed from all modules. I am not sure death run 3d

jennytrippi
Posts: 1
Joined: 19 Oct 2022, 05:58

19 Oct 2022, 06:02

I added it to @NgModule.entryComponents but also can't find DynamicDialogComponent, most likely it has been removed from the modules. Unfortunately stickman boost

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests