From eed2333298412fbad04eda97ded3487c845b9eb9 Mon Sep 17 00:00:00 2001 From: Matias Niemelä Date: Mon, 25 Nov 2013 13:40:52 -0500 Subject: fix(ngAnimate): ensure animations are disabled upon bootstrap for structrual animations Closes #5130 --- src/ngAnimate/animate.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/ngAnimate') diff --git a/src/ngAnimate/animate.js b/src/ngAnimate/animate.js index fde8a7fa..f31932dc 100644 --- a/src/ngAnimate/animate.js +++ b/src/ngAnimate/animate.js @@ -263,9 +263,16 @@ angular.module('ngAnimate', ['ng']) $rootElement.data(NG_ANIMATE_STATE, rootAnimateState); - // disable animations during bootstrap, but once we bootstrapped, enable animations + // disable animations during bootstrap, but once we bootstrapped, wait again + // for another digest until enabling animations. The reason why we digest twice + // is because all structural animations (enter, leave and move) all perform a + // post digest operation before animating. If we only wait for a single digest + // to pass then the structural animation would render its animation on page load. + // (which is what we're trying to avoid when the application first boots up.) $rootScope.$$postDigest(function() { - rootAnimateState.running = false; + $rootScope.$$postDigest(function() { + rootAnimateState.running = false; + }); }); function lookup(name) { -- cgit v1.2.3