pager-factory
v1.2.2
Published
An Angular 1.x module to handle pagination for you
Downloads
2
Readme
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-factory
npm
npm install -S pager-factory
Usage
- 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
pager
as 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);
});
});