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

How to exclude certain array items from total item count on current page #468

Open
andypande opened this issue Jan 16, 2018 · 1 comment

Comments

@andypande
Copy link

Thanks so much for putting this directive together Micheal - it is incredibly useful! I just have one small issue I needed your help with.

Description of issue:
Say I have a list of employee users:
[
{ name: "A", showUser: true}
{ name: "B", showUser: true}
{ name: "C", showUser: false}
]

Imagine this list is 100+ people with the same properties. Out of this list, I'd like the pagination directive to only consider users with showUser set to true when considering which users to show on every page. Basically, if out of the first 40 elements in the list, only 25 of them have showUser set to true, I would want the pagination directive to only display these users whenever show 25 options for pagination is selected. I cannot splice these users from the array as they are needed for other parts of my code.

Demo: http://plnkr.co/edit/ZBQHyxutyqAQpbCljIIo?p=preview
In the plunk above, I want to not include any of the sequences that have firstSequence: "true"

Hope I explained my issue well enough - thanks for your help!

@GerardSetho
Copy link

http://plnkr.co/edit/4NBH8u

It's be a little late, but it might help someone.

This can be done with a standard AngularJS filter.

<li dir-paginate="item in collection |filter:{firstSequence: true} | itemsPerPage: pageSize">{{ item }}</li>

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