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

Commit

Permalink
fix($animate): don't force animations to be enabled
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
IgorMinar committed Nov 8, 2013
1 parent 5cfacec commit 98adc9e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/Angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,6 @@ function bootstrap(element, modules) {
element.data('$injector', injector);
compile(element)(scope);
});
animate.enabled(true);
}]
);
return injector;
Expand Down
7 changes: 6 additions & 1 deletion src/ngAnimate/animate.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,18 @@ angular.module('ngAnimate', ['ng'])
var ELEMENT_NODE = 1;
var NG_ANIMATE_STATE = '$$ngAnimateState';
var NG_ANIMATE_CLASS_NAME = 'ng-animate';
var rootAnimateState = {disabled:true};
var rootAnimateState = {running: true};

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

$rootElement.data(NG_ANIMATE_STATE, rootAnimateState);

// disable animations during bootstrap, but once we bootstrapped, enable animations
$rootScope.$$postDigest(function() {
rootAnimateState.running = false;
});

function lookup(name) {
if (name) {
var matches = [],
Expand Down

0 comments on commit 98adc9e

Please sign in to comment.