@@ -464,7 +464,7 @@ function(SERVICES, COMPONENTS, DEMOS, PAGES, $location, $rootScope, $http, $wind
464
464
} ;
465
465
} )
466
466
467
- . directive ( 'menuToggle' , [ '$timeout' , function ( $timeout ) {
467
+ . directive ( 'menuToggle' , [ '$timeout' , '$mdUtil' , function ( $timeout , $mdUtil ) {
468
468
return {
469
469
scope : {
470
470
section : '='
@@ -479,20 +479,21 @@ function(SERVICES, COMPONENTS, DEMOS, PAGES, $location, $rootScope, $http, $wind
479
479
$scope . toggle = function ( ) {
480
480
controller . toggleOpen ( $scope . section ) ;
481
481
} ;
482
- $scope . $watch (
482
+
483
+ $mdUtil . nextTick ( function ( ) {
484
+ $scope . $watch (
483
485
function ( ) {
484
486
return controller . isOpen ( $scope . section ) ;
485
487
} ,
486
488
function ( open ) {
487
489
var $ul = $element . find ( 'ul' ) ;
488
490
489
- $timeout ( function updateHeight ( ) {
490
- $timeout ( function ( ) {
491
- $ul . css ( { height : ( open ? getTargetHeight ( ) : 0 ) + 'px' } ) ;
492
- } , 0 , false ) ;
491
+ var targetHeight = open ? getTargetHeight ( ) : 0 ;
492
+ $timeout ( function ( ) {
493
+ $ul . css ( { height : targetHeight + 'px' } ) ;
493
494
} , 0 , false ) ;
494
495
495
- function getTargetHeight ( ) {
496
+ function getTargetHeight ( ) {
496
497
var targetHeight ;
497
498
$ul . addClass ( 'no-transition' ) ;
498
499
$ul . css ( 'height' , '' ) ;
@@ -502,8 +503,8 @@ function(SERVICES, COMPONENTS, DEMOS, PAGES, $location, $rootScope, $http, $wind
502
503
return targetHeight ;
503
504
}
504
505
}
505
- ) ;
506
-
506
+ ) ;
507
+ } ) ;
507
508
508
509
var parentNode = $element [ 0 ] . parentNode . parentNode . parentNode ;
509
510
if ( parentNode . classList . contains ( 'parent-list-item' ) ) {
0 commit comments