Skip to content

Commit 0d4323e

Browse files
committed
fix(dialog): use passed in ComponentFactoryResolver to resolve dialog content
Currently the `ComponentFactoryResolver` from the dialog config is only used for the dialog container. These changes switch to also use it for the dialog content component. Fixes #17702.
1 parent 527f1b5 commit 0d4323e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/material/dialog/dialog.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,7 @@ export class MatDialog implements OnDestroy {
242242

243243
// Create a reference to the dialog we're creating in order to give the user a handle
244244
// to modify and close it.
245-
const dialogRef =
246-
new MatDialogRef<T, R>(overlayRef, dialogContainer, config.id);
245+
const dialogRef = new MatDialogRef<T, R>(overlayRef, dialogContainer, config.id);
247246

248247
// When the dialog backdrop is clicked, we want to close it.
249248
if (config.hasBackdrop) {
@@ -261,7 +260,8 @@ export class MatDialog implements OnDestroy {
261260
} else {
262261
const injector = this._createInjector<T>(config, dialogRef, dialogContainer);
263262
const contentRef = dialogContainer.attachComponentPortal<T>(
264-
new ComponentPortal(componentOrTemplateRef, config.viewContainerRef, injector));
263+
new ComponentPortal(componentOrTemplateRef, config.viewContainerRef, injector,
264+
config.componentFactoryResolver));
265265
dialogRef.componentInstance = contentRef.instance;
266266
}
267267

0 commit comments

Comments
 (0)