aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ngAnimate/animate.js3
-rw-r--r--test/ngAnimate/animateSpec.js21
2 files changed, 22 insertions, 2 deletions
diff --git a/src/ngAnimate/animate.js b/src/ngAnimate/animate.js
index 4b35d5fd..959dd55b 100644
--- a/src/ngAnimate/animate.js
+++ b/src/ngAnimate/animate.js
@@ -436,8 +436,7 @@ angular.module('ngAnimate', ['ng'])
cancelChildAnimations(element);
this.enabled(false, element);
$rootScope.$$postDigest(function() {
- element = stripCommentsFromElement(element);
- performAnimation('leave', 'ng-leave', element, null, null, function() {
+ performAnimation('leave', 'ng-leave', stripCommentsFromElement(element), null, null, function() {
$delegate.leave(element);
}, doneCallback);
});
diff --git a/test/ngAnimate/animateSpec.js b/test/ngAnimate/animateSpec.js
index eaed757e..6dd3b117 100644
--- a/test/ngAnimate/animateSpec.js
+++ b/test/ngAnimate/animateSpec.js
@@ -3418,6 +3418,27 @@ describe("ngAnimate", function() {
});
});
+ it('should remove all element and comment nodes during leave animation',
+ inject(function($compile, $rootScope) {
+
+ $rootScope.items = [1,2,3,4,5];
+
+ var element = html($compile(
+ '<div>' +
+ ' <div class="animated" ng-repeat-start="item in items">start</div>' +
+ ' <div ng-repeat-end>end</div>' +
+ '</div>'
+ )($rootScope));
+
+ $rootScope.$digest();
+
+ $rootScope.items = [];
+
+ $rootScope.$digest();
+
+ expect(element.children().length).toBe(0);
+ }));
+
it('should not throw an error when only comment nodes are rendered in the animation',
inject(function($rootScope, $compile) {