![devDependency Status](https://david-dm.org/jgantunes/ampersand-pagination-mixin/dev-status.svg)
ampersand-pagination-mixin
A simple mixin to be used with ampersand collection to perform paginated requests. This module assumes you somehow implement a restful method collection.fetch()
therefore being a perfect match to be used with ampersand-rest-collection. It works by inserting a skip
and limit
fields on the query component of the URI.
Example:
var InfiniteScrollMixin = require('ampersand-pagination-mixin');
var RestCollection = require('ampersand-rest-collection');
var MyModel = require('./MyModel');
var PaginatedCollection = RestCollection.extend(InfiniteScrollMixin, {
model: MyModel,
url: '/api/paginated-resource'
});
var myCollection = new PaginatedCollection();
myCollection.fetchPage();
To use this collection with a infinite scroll view use ampersand-infinite-scroll as it works out of the box with it.
credits
Created by @JGAntunes, with the support of @SINFO.
license
MIT