Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
danilohgds opened this issue Mar 10, 2017 · 1 comment
Open

Comments

@danilohgds
Copy link

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

@lucas-barros
Copy link

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants