一、编写angularJS实现的分页js(网上搜)和样式表(pagination),并在页面引入
二、编写变量和方法
//分页控件控制 $scope.paginationConf={ currentPage:1, //当前页 totalItems:10, //总记录数 itemsPerPage:10, //每页记录数 perPageOptions:[10,20,30,40,50], //分页选项 onChange:function(){ //当页码变更后自动触发的方法 $scope.reloadList(); } }; //刷新列表 $scope.reloadList=function(){ $scope.findPage($scope.paginationConf.currentPage,$scope.paginationConf.itemsPerPage); }; $scope.findPage=function(page,size){ $http.get('../brand/getBrandByPage.do?page='+page+'&size='+size).success(//后台基于pageHelper实现的分页数据获取 function(res){ $scope.list = res.rows;//显示当前页数据 $scope.paginationConf.totalItems=res.total;//更新总记录数 } ) }
三、引入分页变量
页面
品牌管理 class="hold-transition skin-red sidebar-mini" ng-app="eshop" ng-controller="brandController" >class="box-header with-border">class="box-title">品牌管理
class="box-body">class="table-box">class="pull-left">class="form-group form-inline">class="btn-group">class="box-tools pull-right">class="has-feedback">class="table table-bordered table-striped table-hover dataTable">
class="" style="padding-right:0px"> class="icheckbox_square-blue"> class="sorting_asc">品牌ID class="sorting">品牌名称 class="sorting">品牌首字母 class="text-center">操作 {{entity.id}} {{entity.name}} {{entity.firstChar}} class="text-center"> class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">class="modal-dialog" >class="modal-content">class="modal-header">品牌编辑
class="modal-body">class="table table-bordered table-striped" width="800px">
品牌名称 class="form-control" placeholder="品牌名称" > 首字母 class="form-control" placeholder="首字母"> class="modal-footer">