Skip to content

Commit

Permalink
fix(dialog): use passed in ComponentFactoryResolver to resolve dialog…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
crisbeto committed Nov 15, 2019
1 parent 93dc69f commit 5fb1a9b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/material/dialog/dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,7 @@ export class MatDialog implements OnDestroy {

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

// When the dialog backdrop is clicked, we want to close it.
if (config.hasBackdrop) {
Expand All @@ -257,11 +256,12 @@ export class MatDialog implements OnDestroy {
if (componentOrTemplateRef instanceof TemplateRef) {
dialogContainer.attachTemplatePortal(
new TemplatePortal<T>(componentOrTemplateRef, null!,
<any>{ $implicit: config.data, dialogRef }));
<any>{$implicit: config.data, dialogRef}));
} else {
const injector = this._createInjector<T>(config, dialogRef, dialogContainer);
const contentRef = dialogContainer.attachComponentPortal<T>(
new ComponentPortal(componentOrTemplateRef, undefined, injector));
new ComponentPortal(componentOrTemplateRef, undefined, injector,
config.componentFactoryResolver));
dialogRef.componentInstance = contentRef.instance;
}

Expand Down

0 comments on commit 5fb1a9b

Please sign in to comment.