-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.html
46 lines (43 loc) · 1.62 KB
/
example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>example</title>
<link href="bootstrap.min.css" type="text/css" rel="stylesheet"/>
</head>
<body ng-app="myApp" ng-controller="indexCtrl">
<!--------------------------------------- html ----------------------------------------------------->
<!--分页directive-->
<pagination page="page" max-page="maxPage" ng-click="pageTo()"></pagination>
<!--显示文本框-->
<p>当前页数:{{showPage}}</p>
<p>总页数:
<input type="text" ng-model="showMaxPage" ng-change="resetMaxPage()" title="显示的页码"/>
</p>
<!--------------------------------------- js ----------------------------------------------------->
<script src="angular.min.js" type="text/javascript"></script>
<script>
/*引入的模块*/
var app = angular.module('myApp', []);
app.controller('indexCtrl',function($scope){
/*--- 变量 ---*/
$scope.showPage = 1; //显示页数当前为1
$scope.maxPage = 12; //初始化总页数为12
$scope.showMaxPage = 12;
/*--- 绑定函数 ---*/
/* 显示当前页码
* */
$scope.pageTo = function () {
$scope.showPage = $scope.page;
};
/* 改变最大页数
* */
$scope.resetMaxPage = function () {
$scope.page = 1; //初始页复位
$scope.maxPage = $scope.showMaxPage;
};
});
</script>
<script src="pagination.js" type="text/javascript"></script>
</body>
</html>