@@ -13,14 +13,16 @@ import {
13
13
EventEmitter ,
14
14
Renderer ,
15
15
ViewEncapsulation ,
16
- ViewChild
16
+ ViewChild ,
17
+ NgZone
17
18
} from '@angular/core' ;
18
19
import { CommonModule } from '@angular/common' ;
19
20
import { Dir , MdError , coerceBooleanProperty , CompatibilityModule } from '../core' ;
20
21
import { A11yModule } from '../core/a11y/index' ;
21
22
import { FocusTrap } from '../core/a11y/focus-trap' ;
22
23
import { ESCAPE } from '../core/keyboard/keycodes' ;
23
24
import { OverlayModule } from '../core/overlay/overlay-directives' ;
25
+ import 'rxjs/add/operator/first' ;
24
26
25
27
26
28
/** Exception thrown when two MdSidenav are matching the same side. */
@@ -321,6 +323,7 @@ export class MdSidenav implements AfterContentInit {
321
323
] ,
322
324
host : {
323
325
'[class.mat-sidenav-container]' : 'true' ,
326
+ '[class.mat-sidenav-transition]' : '_enableTransitions' ,
324
327
} ,
325
328
encapsulation : ViewEncapsulation . None ,
326
329
} )
@@ -349,8 +352,11 @@ export class MdSidenavContainer implements AfterContentInit {
349
352
private _left : MdSidenav ;
350
353
private _right : MdSidenav ;
351
354
355
+ /** Whether to enable open/close trantions. */
356
+ _enableTransitions = false ;
357
+
352
358
constructor ( @Optional ( ) private _dir : Dir , private _element : ElementRef ,
353
- private _renderer : Renderer ) {
359
+ private _renderer : Renderer , private _ngZone : NgZone ) {
354
360
// If a `Dir` directive exists up the tree, listen direction changes and update the left/right
355
361
// properties to point to the proper start/end.
356
362
if ( _dir != null ) {
@@ -366,6 +372,9 @@ export class MdSidenavContainer implements AfterContentInit {
366
372
this . _watchSidenavAlign ( sidenav ) ;
367
373
} ) ;
368
374
this . _validateDrawers ( ) ;
375
+
376
+ // Give the view a chance to render the initial state, then enable transitions.
377
+ this . _ngZone . onMicrotaskEmpty . first ( ) . subscribe ( ( ) => this . _enableTransitions = true ) ;
369
378
}
370
379
371
380
/**
0 commit comments