AngularJS 前端分页
来源:互联网 发布:linux如何安装xampp 编辑:程序博客网 时间:2024/06/06 06:30
前端分页是什么?不知道
1、head 部分
<head> <link rel="stylesheet" href="/css/bootstrap.css"> <script src="/js/angular/angular.js"></script> <script src="/js/angular-bootstrap/ui-bootstrap-tpls.js"></script> <script> angular.module('ui.bootstrap.demo', ['ui.bootstrap']).controller('PaginationDemoCtrl', function ($scope) { $scope.maxSize = 5; // max-size 可以直接点击跳转的页数 $scope.totalItems = 43; //total-items 总条数 $scope.pageSize = 6; //items-per-page 每页显示条数 $scope.currentPage = 1; //ng-model 当前页数 $scope.numPages = Math.ceil($scope.totalItems/$scope.pageSize) //num-pages 总页数 Math.ceil()向上取整 $scope.allitem = []; //每页所有数据 $scope.data = []; for(let i = 0; i < $scope.totalItems; i++) { let item = new Object(); item.a = i; item.b = i; item.c = i; item.d = i; $scope.data.push(item); } getPageData(); $scope.pageChanged = function() {// $log.log('Page changed to: ' + $scope.currentPage); getPageData(); }; function getPageData() { $scope.allitem = []; let index = $scope.pageSize * ($scope.currentPage -1); $scope.allitem.push($scope.data.slice(index, index + $scope.pageSize)); } }); </script> </head>
2、body 部分
<body> <div ng-controller="PaginationDemoCtrl"> <div class="" style="height: 300px"> <table class="table table-hover " style="text-align: center"> <thead class="bg-primary"> <tr style="text-align: center"> <th style="text-align: center" i18nId="field">字段</th> <th style="text-align: center" i18nId="field">字段</th> <th style="text-align: center" i18nId="field">字段</th> <th style="text-align: center" i18nId="field">字段</th> </tr> </thead> <tbody> <tr ng-repeat="item in allitem[0]"> <td ng-bind="item.a"></td> <td ng-bind="item.b"></td> <td ng-bind="item.c"></td> <td ng-bind="item.d"></td> </tr> </tbody> </table> </div> <ul uib-pagination total-items="totalItems" num-pages="numPages" items-per-page = "pageSize" ng-model="currentPage" ng-change = "pageChanged()" force-ellipses = "true" rotate = "true" max-size="maxSize" first-text="第一页" previous-text="上一页" next-text="下一页" last-text="最后页" boundary-links="true" boundary-link-numbers="true"></ul uib-pagination> </div> </body>
3、运行效果
阅读全文
0 0
- AngularJS 前端分页
- angularjs实现的前端分页控件
- angularjs分页
- angularjs分页
- 前端分页
- 前端分页
- 前端分页
- AngularJS (前端MVC框架)
- AngularJs的前端路由
- 管理后台-前端-AngularJS
- 前端开发入门:AngularJS
- angularjs前端框架
- 前端框架AngularJS
- AngularJs分页加载数据
- AngularJS实现分页显示
- angularjs 完成分页
- AngularJS 表格分页
- 基于Angularjs实现分页
- Hibernate中的代理对象和延迟加载的问题
- QTP11.5破解延长试用
- 随笔
- android Activity 四种启动模式剖析
- 正则表达式
- AngularJS 前端分页
- HTML常用的获取页面属性方法总结(HTTP/HTTPS/request)
- 内存泄漏
- Makefile详解(四)
- 破产债权申报的要求与期限
- 不要把球传给我
- 部署有感
- HOG特征MATLAB实现
- Shell变量