Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ngRepeat acts crazily when adding ngAnimate

I have a list that pretty much looks like this:

<ul>
  <li ng-repeat="acc in get_acc()">
    {{acc.value}}
  </li>
</ul>

and then it is suppose to print!

something like

acc-1
acc-2
acc-3

So..I added angular-animate.js to my project and chnaged the angular version to 1.2.4 as well. added ngAnimate as a dependency to my project!

and use ng-enter etc somewhere else!

and this thing goes crazy!

all of a sudden the list looks like this!

acc-1
acc-2
acc-3
acc-2
acc-1
acc-3
........

all possible permutations!

And in the console I have.

Error: [$rootScope:infdig] http://errors.angularjs.org/1.2.4/$rootScope/infdig?p0=10&p1=%5B%5B%22fn%3A…%20newVal%3A%20%5C%22acc-1%5C%22%3B%20oldVal%3A%20undefined%22%5D%5D
    at Error (<anonymous>)
    at http://localhost:3000/angular/angular.min.js:6:449
    at h.$digest (http://localhost:3000/angular/angular.min.js:100:188)
    at h.$delegate.__proto__.$digest (<anonymous>:844:31)
    at h.$apply (http://localhost:3000/angular/angular.min.js:102:100)
    at h.$delegate.__proto__.$apply (<anonymous>:855:30)
    at http://localhost:3000/angular/angular.min.js:17:415
    at Object.d [as invoke] (http://localhost:3000/angular/angular.min.js:30:352)
    at Xb.c (http://localhost:3000/angular/angular.min.js:17:323)
    at Xb (http://localhost:3000/angular/angular.min.js:18:30) angular.min.js:84
(anonymous function)

Any idea what is happening? Angular docs already are terrible at basics and now this things have no explanation!

like image 383
Amogh Talpallikar Avatar asked Feb 24 '26 10:02

Amogh Talpallikar


1 Answers

It's a bug in Angular, you can find a detailed explanation and discussion at this link.

like image 193
remigio Avatar answered Feb 26 '26 23:02

remigio