From d1fab6d78f971915937c59569ed318f17b236a58 Mon Sep 17 00:00:00 2001 From: Jeremy Elbourn Date: Fri, 22 Mar 2019 16:27:00 -0700 Subject: [PATCH] refactor: mark injectable refs with `@Injectable` Marks `MatDialogRef`, `MatSnackbarRef`, and `MatBottomSheetRef` as `@Injectable`. Though this isn't strictly necessary because they're injected via `PortalInjector`, it makes them consistent with other injectable things. --- src/material/bottom-sheet/bottom-sheet-ref.ts | 8 ++++---- src/material/dialog/dialog-ref.ts | 6 +++--- src/material/snack-bar/snack-bar-ref.ts | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/material/bottom-sheet/bottom-sheet-ref.ts b/src/material/bottom-sheet/bottom-sheet-ref.ts index 258de1fcd332..890eb5460394 100644 --- a/src/material/bottom-sheet/bottom-sheet-ref.ts +++ b/src/material/bottom-sheet/bottom-sheet-ref.ts @@ -6,17 +6,17 @@ * found in the LICENSE file at https://angular.io/license */ -import {Location} from '@angular/common'; import {ESCAPE} from '@angular/cdk/keycodes'; import {OverlayRef} from '@angular/cdk/overlay'; +import {Location} from '@angular/common'; +import {Injectable} from '@angular/core'; import {merge, Observable, Subject} from 'rxjs'; import {filter, take} from 'rxjs/operators'; import {MatBottomSheetContainer} from './bottom-sheet-container'; -/** - * Reference to a bottom sheet dispatched from the bottom sheet service. - */ +/** Reference to a bottom sheet dispatched from the bottom sheet service. */ +@Injectable() export class MatBottomSheetRef { /** Instance of the component making up the content of the bottom sheet. */ instance: T; diff --git a/src/material/dialog/dialog-ref.ts b/src/material/dialog/dialog-ref.ts index 490e5699480d..b3f3fcf09617 100644 --- a/src/material/dialog/dialog-ref.ts +++ b/src/material/dialog/dialog-ref.ts @@ -9,6 +9,7 @@ import {ESCAPE} from '@angular/cdk/keycodes'; import {GlobalPositionStrategy, OverlayRef} from '@angular/cdk/overlay'; import {Location} from '@angular/common'; +import {Injectable} from '@angular/core'; import {Observable, Subject} from 'rxjs'; import {filter, take} from 'rxjs/operators'; import {DialogPosition} from './dialog-config'; @@ -20,9 +21,8 @@ import {MatDialogContainer} from './dialog-container'; // Counter for unique dialog ids. let uniqueId = 0; -/** - * Reference to a dialog opened via the MatDialog service. - */ +/** Reference to a dialog opened via the MatDialog service. */ +@Injectable() export class MatDialogRef { /** The instance of component opened into the dialog. */ componentInstance: T; diff --git a/src/material/snack-bar/snack-bar-ref.ts b/src/material/snack-bar/snack-bar-ref.ts index e8f8d800c4f7..bafef04c53fe 100644 --- a/src/material/snack-bar/snack-bar-ref.ts +++ b/src/material/snack-bar/snack-bar-ref.ts @@ -7,6 +7,7 @@ */ import {OverlayRef} from '@angular/cdk/overlay'; +import {Injectable} from '@angular/core'; import {Observable, Subject} from 'rxjs'; import {MatSnackBarContainer} from './snack-bar-container'; @@ -17,9 +18,8 @@ export interface MatSnackBarDismiss { dismissedByAction: boolean; } -/** - * Reference to a snack bar dispatched from the snack bar service. - */ +/** Reference to a snack bar dispatched from the snack bar service. */ +@Injectable() export class MatSnackBarRef { /** The instance of the component making up the content of the snack bar. */ instance: T;