angularUtils
angularUtils copied to clipboard
dirPagination: $index does not display properly over multiple pages.
Hi there,
I found that $index will not accumulate past the actual page per number count, so u cannot tell them index from your object properly.
I made a plunker where it shows that every page has $index going from 0 to 9 instead of properly going up.
http://plnkr.co/edit/kFR4SUptZowapfJKBy6F?p=preview
That's the expected behavior for $index, in this case it is keeping the iterator offset for the current collection, which has been filtered and has max size of pageSize. If you want the iterator offset based on the unfiltered collection use collection.indexOf(item), like this this:
<div dir-paginate="item in collection | filter:q | itemsPerPage: pageSize ">
<input type="text"
class="form-control"
ng-model="item.price"
aria-describedby="basic-addon1">
{{collection.indexOf(item)}}
</div>