Ng-repeat inputs lose focus

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

I read about it, and it seems that the consensus is that this problem, when binding to primitives was resolved in 1.1.2 *, still my problem persists. Maybe I'm using a repeater incorrectly? Please note that I cannot change the data structure.

I am open to any workarounds or creative hacks. So far, the only thing that I managed to get correctly is to use this version of angular: http://ci.angularjs.org/job/angular.js-pete/12/artifact/build/angular.js

But I do not think that this will be fixed in the near future. Thoughts?

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

+6
source share
1 answer

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> 

Work panel: http://plnkr.co/edit/CEwr2GJ4YrS5H7yBOKJn?p=preview

More here

+13
source

Source: https://habr.com/ru/post/948807/


All Articles