File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -27,12 +27,10 @@ export class MdDialogRef<T> {
27
27
constructor ( private _overlayRef : OverlayRef , public _containerInstance : MdDialogContainer ) {
28
28
_containerInstance . _onAnimationStateChange
29
29
. filter ( ( event : AnimationEvent ) => event . toState === 'exit' )
30
- . subscribe ( ( ) => {
31
- this . _overlayRef . dispose ( ) ;
32
- this . componentInstance = null ;
33
- } , null , ( ) => {
30
+ . subscribe ( ( ) => this . _overlayRef . dispose ( ) , null , ( ) => {
34
31
this . _afterClosed . next ( this . _result ) ;
35
32
this . _afterClosed . complete ( ) ;
33
+ this . componentInstance = null ;
36
34
} ) ;
37
35
}
38
36
Original file line number Diff line number Diff line change @@ -367,6 +367,18 @@ describe('MdDialog', () => {
367
367
} ) ;
368
368
} ) ) ;
369
369
370
+ it ( 'should have the componentInstance available in the afterClosed callback' , fakeAsync ( ( ) => {
371
+ let dialogRef = dialog . open ( PizzaMsg ) ;
372
+
373
+ dialogRef . afterClosed ( ) . subscribe ( ( ) => {
374
+ expect ( dialogRef . componentInstance ) . toBeTruthy ( 'Expected component instance to be defined.' ) ;
375
+ } ) ;
376
+
377
+ dialogRef . close ( ) ;
378
+ tick ( 500 ) ;
379
+ viewContainerFixture . detectChanges ( ) ;
380
+ } ) ) ;
381
+
370
382
describe ( 'passing in data' , ( ) => {
371
383
it ( 'should be able to pass in data' , ( ) => {
372
384
let config = {
You can’t perform that action at this time.
0 commit comments