I am loading some modules lazily by following the article https://blog.angularindepth.com/building-an-aot-friendly-dynamic-content-outlet-in-angular-59c1a96171a.
Once the module is loaded all the material elements should work normally.
I am able to successfully load the module lazily but when dialogs are opened I am getting following error eventhough the components are included in entryComponents array of lazy loaded module.
No component factory found for DynamicMultipleTwoComponent. Did you add it to @NgModule.entryComponents?

Apart from dialog module there is no other issues with any of the material modules.
Unable to reproduce lazy loading the module in Stackblitz. Please check this project to reproduce the issue,
https://github.com/HegdeSach/angular-dynamic-content
"dependencies": {
"@angular/animations": "^7.0.4",
"@angular/cdk": "^7.3.2",
"@angular/common": "~7.0.0",
"@angular/compiler": "~7.0.0",
"@angular/core": "~7.0.0",
"@angular/forms": "~7.0.0",
"@angular/http": "~7.0.0",
"@angular/material": "^7.3.2",
"@angular/platform-browser": "~7.0.0",
"@angular/platform-browser-dynamic": "~7.0.0",
"@angular/router": "~7.0.0",
"core-js": "^2.5.4",
"rxjs": "~6.3.3",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.12.1",
"@angular/cli": "~7.0.6",
"@angular/compiler-cli": "~7.0.0",
"@angular/language-service": "~7.0.0",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.1.6"
}
I am using @angular/material: 6.4.0 version in my actual application. It will be helpful if the issue can be resolved without upgrading material version
I鈥檓 the author of the blog post above and too am curious how to make this work with dialogs in material. Any help would be greatly appreciated.
Have the same issue
Noticed in the example above that it is missing DialogOverviewExample2Dialog in AppModule.
I believe this example that was fixed by DenisSemionov resolves it: https://stackblitz.com/edit/modal-issue-angular-7-429dn9?file=main.ts
Any lazy-loaded component that might be opened in a dialog must also have MatDialogModule imported in its NgModule ) _and_ you need to then use that more specific instance of MatDialog to open the component. This is a limitation of Angular, since the ComponentFactoryResolver at the root level doesn't know about lazy-loaded components, so you need a different MatDialog instance that has injected the "correct" ComponentFactoryResolver.
I've been told that the new ivy renderer will make this easier.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
Any lazy-loaded component that might be opened in a dialog must also have
MatDialogModuleimported in itsNgModule) _and_ you need to then use that more specific instance ofMatDialogto open the component. This is a limitation of Angular, since theComponentFactoryResolverat the root level doesn't know about lazy-loaded components, so you need a differentMatDialoginstance that has injected the "correct"ComponentFactoryResolver.I've been told that the new ivy renderer will make this easier.