mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
fix(ngAnimate): ensure animations are disabled upon bootstrap for structrual animations
Closes #5130
This commit is contained in:
parent
a2809dacc4
commit
eed2333298
3 changed files with 2551 additions and 2501 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -373,6 +373,10 @@ describe('ngClass animations', function() {
|
|||
// Enable animations by triggering the first item in the postDigest queue
|
||||
digestQueue.shift()();
|
||||
|
||||
// wait for the 2nd animation bootstrap digest to pass
|
||||
$rootScope.$digest();
|
||||
digestQueue.shift()();
|
||||
|
||||
$rootScope.val = 'crazy';
|
||||
var element = angular.element('<div ng-class="val"></div>');
|
||||
jqLite($document[0].body).append($rootElement);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue