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> {
2727 constructor ( private _overlayRef : OverlayRef , public _containerInstance : MdDialogContainer ) {
2828 _containerInstance . _onAnimationStateChange
2929 . filter ( ( event : AnimationEvent ) => event . toState === 'exit' )
30- . subscribe ( ( ) => {
31- this . _overlayRef . dispose ( ) ;
32- this . componentInstance = null ;
33- } , null , ( ) => {
30+ . subscribe ( ( ) => this . _overlayRef . dispose ( ) , null , ( ) => {
3431 this . _afterClosed . next ( this . _result ) ;
3532 this . _afterClosed . complete ( ) ;
33+ this . componentInstance = null ;
3634 } ) ;
3735 }
3836
Original file line number Diff line number Diff line change @@ -367,6 +367,18 @@ describe('MdDialog', () => {
367367 } ) ;
368368 } ) ) ;
369369
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+
370382 describe ( 'passing in data' , ( ) => {
371383 it ( 'should be able to pass in data' , ( ) => {
372384 let config = {
You can’t perform that action at this time.
0 commit comments