前端agl分页的写法

匿名 (未验证) 提交于 2019-12-03 00:02:01

<!-- 分页组件开始 -->
<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;
}
);
}

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!