Reputation: 374
I have my ng-repeat and filter ,then I added bootstrap-ui pagination and everything working fine
To add fields Edit, I needed to use 'track by $index' but I cant find the correct way to add it to my ng-repeat, This is my HTML view :
<tr data-ng-repeat="target in targets | filter:search | startFrom:(currentPage - 1) * pageSize | limitTo: pageSize ">
<td><input type="text" ng-model-options="{ updateOn: 'blur' }" ng-change="updateTarget(targets[$index])" ng-model="targets[$index].YEAR"></td>
<td><input type="text" ng-model-options="{ updateOn: 'blur' }" ng-change="updateTarget(targets[$index])" ng-model="targets[$index].MONTH"></td>
<td><input type="text" ng-model-options="{ updateOn: 'blur' }" ng-change="updateTarget(targets[$index])" ng-model="targets[$index].TV"></td>
</tr>
My PageSize Limit is set to 5, so my index restart from 1 to 5 in every page cause I didn't added track by $index in my ng-repeat So if I edit row number 2, it will edit every row number 2 in every page,
Any idea for how to add 'track by $index' when using Filter and Pagination in the same ng-repeat
Upvotes: 1
Views: 1035