<link rel="stylesheet" href="/nutz-test/static/bootstrap/bootstrap.min.css" rel="external nofollow" > <link rel="stylesheet" href="/nutz-test/static/angular/ng-pagination.css" rel="external nofollow" > <script src="/nutz-test/static/jquery/jquery.min.js"></script> <script src="/nutz-test/static/angular/angular.min.js"></script> <script src="/nutz-test/static/angular/ng-pagination.js"></script> <script src="/nutz-test/static/bootstrap/bootstrap.min.js"></script>
<div id="app" ng-app="myApp" ng-controller="myCtrl">
<div style="overflow: auto; width: 100%;">
<table class="table table-hover table-striped table-bordered" id="j-table">
<thead>
<tr>
<th>姓名</th>
<th>年龄</th>
<th>电话</th>
<th>职位</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in list">
<th title="{{item.name}}">{{item.name}}</th>
<th title="{{item.age}}">{{item.age}}</th>
<th title="{{item.tel}}">{{item.tel}}</th>
<th title="{{item.position}}">{{item.position}}</th>
</tr>
</tbody>
</table>
</div>
<!-- 这里引用插件的分页-->
<div class="pager">
<pager page-count="pageCount" current-page="currentPage" on-page-change="onPageChange()" first-text="首页" next-text="下一页" prev-text="上一页" last-text="尾页" show-goto="true" goto-text="跳转到"></pager>
</div>
</div>
<script type="text/javascript">
var app = angular.module('myApp', ['ng-pagination']);
app.controller('myCtrl', ['$scope', function ($scope) {
$scope.onPageChange = function() {
// ajax request to load data
console.log($scope.currentPage);
//这里是post请求去后台取数据
$.ajax({
type:"post",
url:'/nutz-test/show/pagination',
data:{
"pageSize":5,
"pageIndex":$scope.currentPage
},
dataType:"json",
success:function(data){
$scope.$apply(function () {
$scope.list = data.list;
$scope.pageCount = data.pageCount;
});
}
})
};
//初始化,设置为第一页,每页显示5条
$scope.myinit = function(){
$.ajax({
type:"post",
url:'/nutz-test/show/pagination',
data:{
"pageSize":5,
"pageIndex":1
},
dataType:"json",
success:function(data){
$scope.$apply(function () {
$scope.list = data.list;
$scope.pageCount = data.pageCount;
});
}
})
};
$scope.myinit();
}]);
</script>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有