Skip to content

Pagination component + Route and Controller Pagination Mixins

License

Notifications You must be signed in to change notification settings

serjilyashenko/ember-pagination-addon

Repository files navigation

ember-pagination-addon

This README outlines the details of collaborating on this Ember addon.

Installation

Install this add-on through Ember CLI.

  • From the command line run:
    ember install git+https://github.com/serjilyashenko/ember-pagination-addon.git
  • Once installed, run the library's blueprint to pull in its Bower dependencies. This only needs to be done once.
    ember generate ember-pagination-addon
  • Install bower dependencies: bower install

Integration

  • Add component to a template:
{{articles/index-page
   model=model
   setPage=(action 'setPage')
 }}
  • And you must throw 'setPage' action through all components between controller and component with pagination.

  • Extend target route and controller using PaginationRouteMixin and PginationRouteMixin respectively.

import Ember from 'ember';
import PaginationRouteMixin from 'ember-pagination-addon/mixins/pagination-router-mixin';

export default Ember.Route.extend(PaginationRouteMixin, {
});
import Ember from 'ember';
import PaginationControllerMixin from 'ember-pagination-addon/mixins/pagination-controller-mixin';

export default Ember.Controller.extend(PaginationControllerMixin, {
});
  • By default it is applied 30 pages limit. For customization of this use property limit:
import Ember from 'ember';
import PaginationControllerMixin from 'ember-pagination-addon/mixins/pagination-controller-mixin';

export default Ember.Controller.extend(PaginationControllerMixin, {
  limit: 30,
});

About

Pagination component + Route and Controller Pagination Mixins

Resources

License

Stars

Watchers

Forks

Packages

No packages published