@@ -13,7 +13,7 @@ import {
13
13
EventEmitter ,
14
14
Renderer ,
15
15
ViewEncapsulation ,
16
- ViewChild
16
+ ViewChild , NgZone
17
17
} from '@angular/core' ;
18
18
import { CommonModule } from '@angular/common' ;
19
19
import { Dir , MdError , coerceBooleanProperty , CompatibilityModule } from '../core' ;
@@ -321,6 +321,7 @@ export class MdSidenav implements AfterContentInit {
321
321
] ,
322
322
host : {
323
323
'[class.mat-sidenav-container]' : 'true' ,
324
+ '[class.mat-sidenav-transition]' : '_initialized' ,
324
325
} ,
325
326
encapsulation : ViewEncapsulation . None ,
326
327
} )
@@ -349,8 +350,10 @@ export class MdSidenavContainer implements AfterContentInit {
349
350
private _left : MdSidenav ;
350
351
private _right : MdSidenav ;
351
352
353
+ _initialized = false ;
354
+
352
355
constructor ( @Optional ( ) private _dir : Dir , private _element : ElementRef ,
353
- private _renderer : Renderer ) {
356
+ private _renderer : Renderer , private _ngZone : NgZone ) {
354
357
// If a `Dir` directive exists up the tree, listen direction changes and update the left/right
355
358
// properties to point to the proper start/end.
356
359
if ( _dir != null ) {
@@ -366,6 +369,9 @@ export class MdSidenavContainer implements AfterContentInit {
366
369
this . _watchSidenavAlign ( sidenav ) ;
367
370
} ) ;
368
371
this . _validateDrawers ( ) ;
372
+
373
+ // Give the view a chance to render the initial state, then enable transitions.
374
+ this . _ngZone . onMicrotaskEmpty . first ( ) . subscribe ( ( ) => this . _initialized = true ) ;
369
375
}
370
376
371
377
/**
0 commit comments