@@ -14,7 +14,8 @@ import {
14
14
Injector ,
15
15
Inject ,
16
16
ComponentRef ,
17
- OnDestroy
17
+ OnDestroy ,
18
+ Type
18
19
} from '@angular/core' ;
19
20
import { ComponentPortal , PortalInjector , TemplatePortal } from '@angular/cdk/portal' ;
20
21
import { of as observableOf , Observable , Subject , defer } from 'rxjs' ;
@@ -28,6 +29,7 @@ import {
28
29
Overlay ,
29
30
OverlayRef ,
30
31
OverlayConfig ,
32
+ ScrollStrategy ,
31
33
} from '@angular/cdk/overlay' ;
32
34
import { startWith } from 'rxjs/operators' ;
33
35
@@ -45,6 +47,8 @@ import {
45
47
*/
46
48
@Injectable ( )
47
49
export class Dialog implements OnDestroy {
50
+ private _scrollStrategy : ( ) => ScrollStrategy ;
51
+
48
52
/** Stream that emits when all dialogs are closed. */
49
53
get _afterAllClosed ( ) : Observable < void > {
50
54
return this . _parentDialog ? this . _parentDialog . afterAllClosed : this . _afterAllClosedBase ;
@@ -68,8 +72,10 @@ export class Dialog implements OnDestroy {
68
72
constructor (
69
73
private overlay : Overlay ,
70
74
private injector : Injector ,
71
- @Inject ( DIALOG_REF ) private dialogRefConstructor ,
72
- @Inject ( DIALOG_SCROLL_STRATEGY ) private _scrollStrategy ,
75
+ @Inject ( DIALOG_REF ) private dialogRefConstructor : Type < DialogRef < any > > ,
76
+ // TODO(crisbeto): the `any` here can be replaced
77
+ // with the proper type once we start using Ivy.
78
+ @Inject ( DIALOG_SCROLL_STRATEGY ) scrollStrategy : any ,
73
79
@Optional ( ) @SkipSelf ( ) private _parentDialog : Dialog ,
74
80
@Optional ( ) location : Location ) {
75
81
@@ -79,6 +85,8 @@ export class Dialog implements OnDestroy {
79
85
if ( ! _parentDialog && location ) {
80
86
location . subscribe ( ( ) => this . closeAll ( ) ) ;
81
87
}
88
+
89
+ this . _scrollStrategy = scrollStrategy ;
82
90
}
83
91
84
92
/** Gets an open dialog by id. */
0 commit comments