2

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 using latest version of Angular and Material

"@angular/core": "^5.0.0", "@angular/material": "^5.0.0-rc0"

DAN
  • 3,140
  • 5
  • 20
  • 22

2 Answers2

2

In my case, I imported MatDialogModule into my lazy loaded module, but still used MatDialog instance from root module, because MatDialog was injected into my own DialogService, which is provided in root module. When I use correct MatDialog instance, from lazy loaded module, there is no error.

Valeriy Katkov
  • 33,616
  • 20
  • 100
  • 123
0

This is fixed. I forgot to import MatDialogModule in my lazy loaded module.

DAN
  • 3,140
  • 5
  • 20
  • 22