AngularJs--angular-pagination可复用的分页指令

1、angular-pagination

是基于angular 编写的可复用分页指令

安装

克隆项目到本地:

git clone https://github.com/febobo/angular-pagination.git

要跑demo环境要求:

node , bower , npm , gulp

安装: npm install && bower install

运行: gulp serve

demo用法

html

1 <body ng-app="demo" ng-controller="demoCtro" class="row text-center">
2     <div ui-pagination conf="conf"></div>
3 </body>

JS

 1 var app = angular.module('demo' , ['pagination']);
 2 
 3   app.controller('demoCtro' , function($scope){
 4 
 5       $scope.title = 'pagination-directive';
 6 
 7       $scope.conf = {
 8 
 9         // 总条数
10         total : 1190,
11 
12         // 当前页
13         currentPage : 1,
14 
15         // 一页展示多少条
16         itemPageLimit : 1,
17 
18         // 是否显示一页选择多少条
19         isSelectPage : false,
20 
21         // 是否显示快速跳转
22         isLinkPage : false
23       }
24 
25       // 监控你的页码 , 发生改变既请求
26       $scope.$watch('conf.currentPage + conf.itemPageLimit' , function(news){
27          // 把你的http请求放到这里
28          console.log($scope.conf.currentPage , $scope.conf.itemPageLimit)
29       })
30   })