angular-restmod icon indicating copy to clipboard operation
angular-restmod copied to clipboard

[features] Better support for pagination and search query params in $location

Open facultymatt opened this issue 10 years ago • 5 comments

This library https://github.com/brettshollenberger/the-abstractions-are-leaking/wiki/Pagination has a great feature where page and other query params are kept in sync with $location.

For example, in the following example:

$scope.posts = Post.$fetch({page: 1});

The $location service would be used to auto append the url with

?page=1

If you also queried Post.$fetch({page: 1, owner: 99}) then the query string would update to

?page=1&owner=99

Read more here: https://github.com/brettshollenberger/the-abstractions-are-leaking/wiki/Query-Interface#maintaining-state

What are your thoughts on this feature?

facultymatt avatar Jan 29 '15 22:01 facultymatt

I'll give it a thought, the Pagination mixin definitely needs a little attention!

iobaixas avatar Feb 02 '15 15:02 iobaixas

I have a great working mixin for this! I will post today...

On Mon, Feb 2, 2015 at 10:23 AM, Ignacio Baixas [email protected] wrote:

I'll give it a thought, the Pagination mixin definitely needs a little attention!

— Reply to this email directly or view it on GitHub https://github.com/platanus/angular-restmod/issues/242#issuecomment-72474921 .

Matt Miller

Web Master 609-335-4417 [email protected] https://www.superpedestrian.com/ https://www.google.com/url?q=https%3A%2F%2Fwww.superpedestrian.com%2F&sa=D&sntz=1&usg=AFQjCNHLEDFaMLgggeXL8rh4gGlNfN0WSA


Superpedestrian Inc. 84 Hamilton St. Cambridge, MA 02139

This message is intended only for the addressee named above. If you are not the intended recipient of this message, you are hereby notified that you must not use, disseminate, or copy it in any form or take any action in reliance upon it. If you have received this message in error, please delete it and any copies of it from your email system and reply immediately to the sender at the address shown above. This message may contain confidential and/or proprietary information. Neither confidentiality, nor any proprietary rights are intended to be waived or lost by any error in transmission.

facultymatt avatar Feb 02 '15 15:02 facultymatt

See https://github.com/facultymatt/angular-restmod/compare/features/paginate-querystring?expand=1

First pass, still needs optimization, especially around mixing into multiple models and conflicts that might occur.

facultymatt avatar Feb 03 '15 15:02 facultymatt

Some comments:

  • Making totalCount a variable of the mixin function closure scope will mean that every collection of the same type will share the same totalCount, maybe it should be stored in a collection property?
  • I think its important to support changing the names of the properties (page, limit, totalCount).
  • What do you think on supporting paging information in headers? we use that a lot here in Platanus.
  • About the queryString plugin, it would be cool to have the collection attach/detach from the query string using a method, since in most cases I only want a collection to be affected by the query string only in some app states. (bindToRoute() maybe?).

I'm currently on vacations, it may take a little longer for me to answer your posts.

iobaixas avatar Feb 05 '15 23:02 iobaixas

Any progress?

svenstaro avatar May 05 '15 23:05 svenstaro