angularUtils icon indicating copy to clipboard operation
angularUtils copied to clipboard

Pagination: Multiple instances with asynchronous data

Open lsturtevant opened this issue 10 years ago • 1 comments

I've got the pagination library to work with my site. So far it's working great, thanks for the library.

But I have a question regarding multiple instances and asynchronous data on the same page. For the asynchronous data to work, you define the callback for on-page-change. This callback only passes the page number. When I have multiple instances on the page, how am I suppose to know which one pagination is being used?

I could do it where I define a unique function for each pagination, but that's ugly, especially with a very dynamic page.

The best way I can think of doing this is if the on-page-change callback passed the newPageNumber as well as the paginationId. Then I can identify which control is being used. Would that change be possible? Is there a better way of doing it?

lsturtevant avatar Aug 19 '15 05:08 lsturtevant

Good point. For now I think you might be able to get around that by using a $watch on the value of each pagination's "current-page", and triggering a function when it changes.

Not tested and perhaps there are issues with that, but try it out and let me know.

michaelbromley avatar Aug 19 '15 06:08 michaelbromley