Angular doesn't bind repeater after first push to array

后端 未结 1 634
广开言路
广开言路 2021-01-25 22:46

I have an angular repeater bound to an array. When I push a new item, the UI updates as expected, but for subsequent pushes, the array updates but the UI doesn\'t change. I alre

相关标签:
1条回答
  • 2021-01-25 22:56

    It's because you are pussing the same value again and again which creates duplicate elements, try using track by index

     <li data-ng-repeat="item in values track by $index"> 
    

    working fiddle

    0 讨论(0)
提交回复
热议问题