Skip to content

Commit 0908be7

Browse files
jelbournmmalerba
authored andcommitted
refactor: mark injectable refs with @Injectable (#15584)
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.
1 parent 558295b commit 0908be7

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/material/bottom-sheet/bottom-sheet-ref.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {Location} from '@angular/common';
109
import {ESCAPE} from '@angular/cdk/keycodes';
1110
import {OverlayRef} from '@angular/cdk/overlay';
11+
import {Location} from '@angular/common';
12+
import {Injectable} from '@angular/core';
1213
import {merge, Observable, Subject} from 'rxjs';
1314
import {filter, take} from 'rxjs/operators';
1415
import {MatBottomSheetContainer} from './bottom-sheet-container';
1516

1617

17-
/**
18-
* Reference to a bottom sheet dispatched from the bottom sheet service.
19-
*/
18+
/** Reference to a bottom sheet dispatched from the bottom sheet service. */
19+
@Injectable()
2020
export class MatBottomSheetRef<T = any, R = any> {
2121
/** Instance of the component making up the content of the bottom sheet. */
2222
instance: T;

src/material/dialog/dialog-ref.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import {ESCAPE} from '@angular/cdk/keycodes';
1010
import {GlobalPositionStrategy, OverlayRef} from '@angular/cdk/overlay';
1111
import {Location} from '@angular/common';
12+
import {Injectable} from '@angular/core';
1213
import {Observable, Subject} from 'rxjs';
1314
import {filter, take} from 'rxjs/operators';
1415
import {DialogPosition} from './dialog-config';
@@ -20,9 +21,8 @@ import {MatDialogContainer} from './dialog-container';
2021
// Counter for unique dialog ids.
2122
let uniqueId = 0;
2223

23-
/**
24-
* Reference to a dialog opened via the MatDialog service.
25-
*/
24+
/** Reference to a dialog opened via the MatDialog service. */
25+
@Injectable()
2626
export class MatDialogRef<T, R = any> {
2727
/** The instance of component opened into the dialog. */
2828
componentInstance: T;

src/material/snack-bar/snack-bar-ref.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88

99
import {OverlayRef} from '@angular/cdk/overlay';
10+
import {Injectable} from '@angular/core';
1011
import {Observable, Subject} from 'rxjs';
1112
import {MatSnackBarContainer} from './snack-bar-container';
1213

@@ -17,9 +18,8 @@ export interface MatSnackBarDismiss {
1718
dismissedByAction: boolean;
1819
}
1920

20-
/**
21-
* Reference to a snack bar dispatched from the snack bar service.
22-
*/
21+
/** Reference to a snack bar dispatched from the snack bar service. */
22+
@Injectable()
2323
export class MatSnackBarRef<T> {
2424
/** The instance of the component making up the content of the snack bar. */
2525
instance: T;

0 commit comments

Comments
 (0)