mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-24 02:10:24 +00:00
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).
This commit is contained in:
parent
5cfacec499
commit
98adc9e038
2 changed files with 6 additions and 2 deletions
|
|
@ -1207,7 +1207,6 @@ function bootstrap(element, modules) {
|
|||
element.data('$injector', injector);
|
||||
compile(element)(scope);
|
||||
});
|
||||
animate.enabled(true);
|
||||
}]
|
||||
);
|
||||
return injector;
|
||||
|
|
|
|||
|
|
@ -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 = [],
|
||||
|
|
|
|||
Loading…
Reference in a new issue