1.2.2 • Published 9 years ago
pager-factory v1.2.2
Pager - A factory for pagination objects
A component factory to handle pagination for you
How to get it ?
Manual Download
Download the from here
Bower
bower install pager-factorynpm
npm install -S pager-factoryUsage
- 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>
- Set - pageras a dependency in your module- var myApp = angular.module('myApp', ['pager'])
- Add pager directive to the wanted element and churn out pagers! - myApp.controller('someCtrl', ['pager', function(pager) { var myPager = new pager(15); }]);
- 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); 
      });
  });