Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 98adc9e

Browse files
committedNov 8, 2013
fix($animate): don't force animations to be enabled
The way that enabling of animations was set up, made it impossible to inject a module into the bootstrap to disable animations for things like end 2 end tests. Now animations are temporarily blocked by setting the animation state to RUNNING during bootstrap, which allows the developer to permanently disable at any point by calling $animate.enabled(false).
1 parent 5cfacec commit 98adc9e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed
 

‎src/Angular.js

-1
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,6 @@ function bootstrap(element, modules) {
12071207
element.data('$injector', injector);
12081208
compile(element)(scope);
12091209
});
1210-
animate.enabled(true);
12111210
}]
12121211
);
12131212
return injector;

‎src/ngAnimate/animate.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -256,13 +256,18 @@ angular.module('ngAnimate', ['ng'])
256256
var ELEMENT_NODE = 1;
257257
var NG_ANIMATE_STATE = '$$ngAnimateState';
258258
var NG_ANIMATE_CLASS_NAME = 'ng-animate';
259-
var rootAnimateState = {disabled:true};
259+
var rootAnimateState = {running: true};
260260

261261
$provide.decorator('$animate', ['$delegate', '$injector', '$sniffer', '$rootElement', '$timeout', '$rootScope', '$document',
262262
function($delegate, $injector, $sniffer, $rootElement, $timeout, $rootScope, $document) {
263263

264264
$rootElement.data(NG_ANIMATE_STATE, rootAnimateState);
265265

266+
// disable animations during bootstrap, but once we bootstrapped, enable animations
267+
$rootScope.$$postDigest(function() {
268+
rootAnimateState.running = false;
269+
});
270+
266271
function lookup(name) {
267272
if (name) {
268273
var matches = [],

0 commit comments

Comments
 (0)
This repository has been archived.