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

ngAnimate throws errors (leaves stale items) for ngRepeat with nested ngInclude #4716

@alexjc

Description

@alexjc

The title describes the bug well enough I think, and here's my local hack to fix it:

index 64be7ba..7ef8d6d 100644
--- a/src/ngAnimate/animate.js
+++ b/src/ngAnimate/animate.js
@@ -256,6 +256,8 @@ angular.module('ngAnimate', ['ng'])
     var selectors = $animateProvider.$$selectors;

     var ELEMENT_NODE = 1;
+    var ELEMENT_DOCUMENTATION = 8;
+
     var NG_ANIMATE_STATE = '$$ngAnimateState';
     var NG_ANIMATE_CLASS_NAME = 'ng-animate';
     var rootAnimateState = {disabled:true};
@@ -883,6 +885,13 @@ angular.module('ngAnimate', ['ng'])
           startTime = Date.now(),
           node = element[0];

+          // When using ng-include within an ng-repeat, it's not always the first
+          // child element, that's a comment inserted by ng-include.  In the case
+          // if this node is a comment, get the next one.
+          if (node.nodeType == ELEMENT_DOCUMENTATION) {
+            node = element[1];
+          }
+
       //temporarily disable the transition so that the enter styles
       //don't animate twice (this is here to avoid a bug in Chrome/FF).
       if(timings.transitionDuration > 0) {

If this looks sensible to you let me know and I can submit a pull request. If not, let me know ;-)

Alex

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions