pager-factory

1.2.2 • Public • Published

Pager - A factory for pagination objects

Build Status Coverage Status Dependency Status

A component factory to handle pagination for you

How to get it ?

Manual Download

Download the from here

Bower

bower install pager-factory

npm

npm install -S pager-factory

Usage

  1. Add pager.js to your main file (index.html) or include it in your bundle
<script type="text/javascript" src="bower_components/pager/dist/pager-factory.js"></script>
  1. Set pager as a dependency in your module
var myApp = angular.module('myApp', ['pager'])
  1. Add pager directive to the wanted element and churn out pagers!
myApp.controller('someCtrl', ['pager', function(pager) {
  var myPager = new pager(15);
}]);
  1. See the API Ref for more details

Basic Example

angular
  .module('myApp', ['pager'])
  .controller('homeCtrl', function(pager, someService) {
    var myPager = new pager(15); //optionally set page size on construction
    
    var request = myPager.createPagedRequest(); // Generates a request with page number and size
    someService.asyncCall(request)
      .then(function(success) {
        // Add the new page of results and set the total count
        myPager.addPage(success.results, success.totalCount); 
      });
  });

Readme

Keywords

none

Package Sidebar

Install

npm i pager-factory

Weekly Downloads

1

Version

1.2.2

License

MIT

Last publish

Collaborators

  • wilsongp