Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

pagination module initializes ngModel to 1 if total-items starts out undefined #2956

Closed
AlJohri opened this issue Nov 12, 2014 · 5 comments
Closed

Comments

@AlJohri
Copy link

AlJohri commented Nov 12, 2014

I'm grabbing metadata from an API where I know which page I would like to grab via the url parameters, but the total-items takes a few milliseconds to populate.

Because total-items starts out undefined, ngModel is changed from the correct page number to 1.

The only way I have gotten around this is to initialize total-items to an arbitrary number such as 1000. Then the page number is left alone.

Is there a better solution?

@chrisirhc
Copy link
Contributor

This sounds like a bug. However, in order for me to verify and test the fix, I need a Plunker that demonstrates this issue. Do you mind creating an Plunker for this? You could use $timeout to simulate retrieval of the total-items.

@AlJohri
Copy link
Author

AlJohri commented Nov 12, 2014

@juanfran
Copy link

If I set currentPage at the same time that totalItems it works well

@brandonarbini
Copy link

+1, just ran into this. Not sure how to fix it or I'd submit a PR.

@wesleycho
Copy link
Contributor

I am not sure if we want to change anything in the pagination here - what should num-pages return in this instance? How should the UI look?

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

No branches or pull requests

5 participants