Skip to content

Commit 34aa846

Browse files
committed
Revert "refactor(material/dialog): use embedded injector to provide ref to template dialogs"
This reverts commit 6d0487b.
1 parent 33d07df commit 34aa846

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

src/material/dialog/dialog-content-directives.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,6 @@ export class MatDialogContent {}
149149
})
150150
export class MatDialogActions {}
151151

152-
// TODO(crisbeto): this utility shouldn't be necessary anymore, because the dialog ref is provided
153-
// both to component and template dialogs through DI. We need to keep it around, because there are
154-
// some internal wrappers around `MatDialog` that happened to work by accident, because we had this
155-
// fallback logic in place.
156152
/**
157153
* Finds the closest MatDialogRef to an element by looking at the DOM.
158154
* @param element Element relative to which to look for a dialog.

src/material/dialog/dialog.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -292,21 +292,16 @@ export abstract class _MatDialogBase<C extends _MatDialogContainerBase> implemen
292292
// Create a reference to the dialog we're creating in order to give the user a handle
293293
// to modify and close it.
294294
const dialogRef = new this._dialogRefConstructor(overlayRef, dialogContainer, config.id);
295-
const injector = this._createInjector<T>(config, dialogRef, dialogContainer);
296295

297296
if (componentOrTemplateRef instanceof TemplateRef) {
298297
dialogContainer.attachTemplatePortal(
299-
new TemplatePortal<T>(
300-
componentOrTemplateRef,
301-
null!,
302-
<any>{
303-
$implicit: config.data,
304-
dialogRef,
305-
},
306-
injector,
307-
),
298+
new TemplatePortal<T>(componentOrTemplateRef, null!, <any>{
299+
$implicit: config.data,
300+
dialogRef,
301+
}),
308302
);
309303
} else {
304+
const injector = this._createInjector<T>(config, dialogRef, dialogContainer);
310305
const contentRef = dialogContainer.attachComponentPortal<T>(
311306
new ComponentPortal(
312307
componentOrTemplateRef,

0 commit comments

Comments
 (0)