Skip to content

Commit 5fb1a9b

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 93dc69f commit 5fb1a9b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/material/dialog/dialog.ts

+4-4
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) {
@@ -257,11 +256,12 @@ export class MatDialog implements OnDestroy {
257256
if (componentOrTemplateRef instanceof TemplateRef) {
258257
dialogContainer.attachTemplatePortal(
259258
new TemplatePortal<T>(componentOrTemplateRef, null!,
260-
<any>{ $implicit: config.data, dialogRef }));
259+
<any>{$implicit: config.data, dialogRef}));
261260
} else {
262261
const injector = this._createInjector<T>(config, dialogRef, dialogContainer);
263262
const contentRef = dialogContainer.attachComponentPortal<T>(
264-
new ComponentPortal(componentOrTemplateRef, undefined, injector));
263+
new ComponentPortal(componentOrTemplateRef, undefined, injector,
264+
config.componentFactoryResolver));
265265
dialogRef.componentInstance = contentRef.instance;
266266
}
267267

0 commit comments

Comments
 (0)