@@ -14,7 +14,8 @@ import {
1414 Injector ,
1515 Inject ,
1616 ComponentRef ,
17- OnDestroy
17+ OnDestroy ,
18+ Type
1819} from '@angular/core' ;
1920import { ComponentPortal , PortalInjector , TemplatePortal } from '@angular/cdk/portal' ;
2021import { of as observableOf , Observable , Subject , defer } from 'rxjs' ;
@@ -28,6 +29,7 @@ import {
2829 Overlay ,
2930 OverlayRef ,
3031 OverlayConfig ,
32+ ScrollStrategy ,
3133} from '@angular/cdk/overlay' ;
3234import { startWith } from 'rxjs/operators' ;
3335
@@ -45,6 +47,8 @@ import {
4547 */
4648@Injectable ( )
4749export class Dialog implements OnDestroy {
50+ private _scrollStrategy : ( ) => ScrollStrategy ;
51+
4852 /** Stream that emits when all dialogs are closed. */
4953 get _afterAllClosed ( ) : Observable < void > {
5054 return this . _parentDialog ? this . _parentDialog . afterAllClosed : this . _afterAllClosedBase ;
@@ -68,8 +72,10 @@ export class Dialog implements OnDestroy {
6872 constructor (
6973 private overlay : Overlay ,
7074 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 ,
7379 @Optional ( ) @SkipSelf ( ) private _parentDialog : Dialog ,
7480 @Optional ( ) location : Location ) {
7581
@@ -79,6 +85,8 @@ export class Dialog implements OnDestroy {
7985 if ( ! _parentDialog && location ) {
8086 location . subscribe ( ( ) => this . closeAll ( ) ) ;
8187 }
88+
89+ this . _scrollStrategy = scrollStrategy ;
8290 }
8391
8492 /** Gets an open dialog by id. */
0 commit comments