angularUtils icon indicating copy to clipboard operation
angularUtils copied to clipboard

dirPagination: $index does not display properly over multiple pages.

Open danilohgds opened this issue 8 years ago • 1 comments

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

danilohgds avatar Mar 10 '17 21:03 danilohgds

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>

lucas-barros avatar Mar 11 '17 18:03 lucas-barros