diff options
| author | Matias Niemelä | 2014-02-21 03:43:50 -0500 | 
|---|---|---|
| committer | Matias Niemelä | 2014-02-26 14:53:57 -0500 | 
| commit | e9881991ca0a5019d3a4215477738ed247898ba0 (patch) | |
| tree | 5bca5a431522715543288b94772882dcd994bbe2 /src/ng/directive/ngInclude.js | |
| parent | c9245cf759108add2a10ffca4d41b1c68c1e8c76 (diff) | |
| download | angular.js-e9881991ca0a5019d3a4215477738ed247898ba0.tar.bz2 | |
fix($animate): ensure that animateable directives cancel expired leave animations
If enter -> leave -> enter -> leave occurs then the first leave animation will
animate alongside the second. This causes the very first DOM node (the view in ngView
for example) to animate at the same time as the most recent DOM node which ends
up being an undesired effect. This fix takes care of this issue.
Closes #5886
Diffstat (limited to 'src/ng/directive/ngInclude.js')
| -rw-r--r-- | src/ng/directive/ngInclude.js | 12 | 
1 files changed, 10 insertions, 2 deletions
| diff --git a/src/ng/directive/ngInclude.js b/src/ng/directive/ngInclude.js index 29e3abce..272e199a 100644 --- a/src/ng/directive/ngInclude.js +++ b/src/ng/directive/ngInclude.js @@ -177,15 +177,23 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$animate'        return function(scope, $element, $attr, ctrl, $transclude) {          var changeCounter = 0,              currentScope, +            previousElement,              currentElement;          var cleanupLastIncludeContent = function() { -          if (currentScope) { +          if(previousElement) { +            previousElement.remove(); +            previousElement = null; +          } +          if(currentScope) {              currentScope.$destroy();              currentScope = null;            }            if(currentElement) { -            $animate.leave(currentElement); +            $animate.leave(currentElement, function() { +              previousElement = null; +            }); +            previousElement = currentElement;              currentElement = null;            }          }; | 
