前端agl分页的写法

<!-- 分页组件开始 -->
<script src="../plugins/angularjs/pagination.js"></script>
<link rel="stylesheet" href="../plugins/angularjs/pagination.css">

<script type="text/javascript"> // 分页的插件名称
var app=angular.module('pinyougou', ['pagination']);//定义模块
app.controller('brandController' ,function($scope,$http){
$scope.findAll=function(){
$http.get('../brand/findAll.do').success(
function(response){
$scope.list=response;
}
);
}

$scope.reloadList=function(){
$scope.findPage( $scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage);
}


$scope.paginationConf = {

currentPage: 1,

totalItems: 10,

itemsPerPage: 10,

perPageOptions: [10, 20, 30, 40, 50],
onChange: function(){
$scope.reloadList();
}
};


$scope.findPage=function(page,rows){
$http.get('../brand/findPage.do?page='+page+'&rows='+rows).success(

function(response){

$scope.list=response.rows;

$scope.paginationConf.totalItems=response.total;
}
);
}

猜你喜欢

转载自www.cnblogs.com/lijun6/p/11503589.html
今日推荐