Description
Feature Description
The portal made by MatDialog always defaults to the root component factory resolver, which means any dynamically rendered components must be registered in the root component. This seems to cause a lot of confusion (#1491, #8473) and lots of stack overflow posts.
Having to declare these components in the root module is bad for modularity and code splitting. It seems that if we could provide the component factory resolver to the portal (similar to how the viewContainerRef is provided for the injector), then it would be possible to define the dynamically created entryComponents in modules closer to where they're used.
See
components/src/material/dialog/dialog.ts
Lines 268 to 269 in 94ad613
Use Case
Support lazy loaded dialog components, allowing for better code modularity and more precise code splitting.