File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -92,11 +92,9 @@ export class MdSnackBarContainer extends BasePortalHost implements OnDestroy {
9292 /** Handle end of animations, updating the state of the snackbar. */
9393 onAnimationEnd ( event : AnimationTransitionEvent ) {
9494 if ( event . toState === 'void' || event . toState === 'complete' ) {
95- this . _ngZone . run ( ( ) => {
96- this . onExit . next ( ) ;
97- this . onExit . complete ( ) ;
98- } ) ;
95+ this . _completeExit ( ) ;
9996 }
97+
10098 if ( event . toState === 'visible' ) {
10199 this . _ngZone . run ( ( ) => {
102100 this . onEnter . next ( ) ;
@@ -131,8 +129,14 @@ export class MdSnackBarContainer extends BasePortalHost implements OnDestroy {
131129 * Makes sure the exit callbacks have been invoked when the element is destroyed.
132130 */
133131 ngOnDestroy ( ) {
134- // Wait for the zone to settle before removing the element. Helps prevent
135- // errors where we end up removing an element which is in the middle of an animation.
132+ this . _completeExit ( ) ;
133+ }
134+
135+ /**
136+ * Waits for the zone to settle before removing the element. Helps prevent
137+ * errors where we end up removing an element which is in the middle of an animation.
138+ */
139+ private _completeExit ( ) {
136140 this . _ngZone . onMicrotaskEmpty . first ( ) . subscribe ( ( ) => {
137141 this . onExit . next ( ) ;
138142 this . onExit . complete ( ) ;
You can’t perform that action at this time.
0 commit comments