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

Commit 6b72598

Browse files
committed
fix($animate): do not throw errors if element is removed before animation starts
Closes #10205
1 parent 51e24d7 commit 6b72598

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/ngAnimate/animate.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,9 +1194,12 @@ angular.module('ngAnimate', ['ng'])
11941194
}
11951195

11961196
return cache.promise = runAnimationPostDigest(function(done) {
1197-
var parentElement = element.parent();
1198-
var elementNode = extractElementNode(element);
1199-
var parentNode = elementNode.parentNode;
1197+
var parentNode, parentElement, elementNode = extractElementNode(element);
1198+
if (elementNode) {
1199+
parentElement = element.parent();
1200+
parentNode = elementNode.parentNode;
1201+
}
1202+
12001203
// TODO(matsko): move this code into the animationsDisabled() function once #8092 is fixed
12011204
if (!parentNode || parentNode['$$NG_REMOVED'] || elementNode['$$NG_REMOVED']) {
12021205
done();

0 commit comments

Comments
 (0)