Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ng-repeat inputs losing function losing focus

http://plnkr.co/edit/g89wEeG30sOXhgzHWX0Z?p=preview

I've been reading about this and the consensus seems to be that this issue when binding to primitives was resolved in 1.1.2*, yet my problem persists. Maybe I'm using the repeater incorrectly? Please note that I am unable to change the data-structure.

I'm open to any work-arounds or creative hacks. So far, the only thing I've been able get working correctly was using this version of angular: http://ci.angularjs.org/job/angular.js-pete/12/artifact/build/angular.js

But I dont think it's going to be patched in any time soon. Thoughts?

* Difficulty with ng-model, ng-repeat, and inputs

like image 395
jriggs Avatar asked Jul 05 '13 17:07

jriggs


1 Answers

You need to use the new ngRepeat syntax (introduced in 1.1.x) and use track by $index:

<td ng-repeat="point in series.data  track by $index">
  <input type="number"  ng-model="series.data[$index]" />
</td>

Working plunk: http://plnkr.co/edit/CEwr2GJ4YrS5H7yBOKJn?p=preview

More info here

like image 108
pkozlowski.opensource Avatar answered Nov 15 '22 07:11

pkozlowski.opensource