I am currently working on an application using the Rails (4.1.0) API and Ember (2.1.0), and it is difficult for me to paginate in Ember's works.
Rails API JSON output includes automatically made links to pages (from a combination of the JSON API adapter in AMS and Kaminari pagination) as follows:
"links": {
"self": "http://example.com/articles?page[number]=3&page[size]=1",
"first": "http://example.com/articles?page[number]=1&page[size]=1",
"prev": "http://example.com/articles?page[number]=2&page[size]=1",
"next": "http://example.com/articles?page[number]=4&page[size]=1",
"last": "http://example.com/articles?page[number]=13&page[size]=1"
}
Can someone give me a hint on how to get to these values in Ember-Data to use them in an Ember template? Has anyone found a temporary workaround for this problem (since Ember is likely to be fully compatible with the JSON API one day)?
Any help would be greatly appreciated;)
Link to the combination of the JSON API adapter in the AMS and Kaminari pages:
https://github.com/rails-api/active_model_serializers/blob/master/docs/howto/add_pagination_links.md
Edit:
After some progress on this question, I think it’s better to ask now:
How do I pass a hash like page: { number: x, size: y }
in params in an Ember Rails API request?
source
share