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.

Broken ngRepeat directive in angular.js 1.2 #5054

Closed
@kamilkp

Description

@kamilkp

Hi,
I am currently using angular.js 1.2.0 in my projects and I stumbled across some problems with ngRepeat. The problem occurs, when i move some of the ngRepeat's rendered elements into another place in DOM. Sample app where the problem occurs can be found here: http://kamilkp.co.nf/brokenNgRepeat/

You need to:

  1. click "reorder first two items" button
  2. click "replace list model" button.

First action takes the second ngRepeated div detaches it and places it as the first element in the containter (using simple jQuery detach and prependTo). The second action replaces the ngRepeat "items" array with a new array. This causes a "cannot call method insertBefore of undefined" error.

As opposed to angular 1.2.0 ngRepeat directive the same app (and same scenario) works as expected with angular 1.1.4 (http://kamilkp.co.nf/workingNgRepeat/)

You can easily "x-ray" both apps with Chrome dev tools and they should be pretty straightforward.

This issue is super annoying and it exists also in 1.2.0 rc3 and rc2. Up until now i've been copying old angular ngRepeat directive from 1.1.4 version along with $animator and $animation services to work. But now that i have some awesome animations with new ngAnimate API i'm stuck ;/

The only way to make the new ngRepeat directive work is to manually move the html comment node "end ngRepeat" along with the element being moved (i see that now that comment is present after each ngRepeated element, not after last element as it was in the old version). But doing that is just sad ;(

P.S. in my projects i need this kind of behaviour to work because i implement some complex animations which consist of e.g. moving elements beetwen their corresponding arrays.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions