Skip to content

Commit 5cbbf3e

Browse files
committed
tm.pagination
1 parent ee57ff3 commit 5cbbf3e

File tree

324 files changed

+100432
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

324 files changed

+100432
-3
lines changed

README.md

100644100755
Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,39 @@
1-
ng
2-
==
1+
# AngularJs UI -- Want to be the best UI
2+
3+
Since name for a UI is boring, so I decide name it to tm.I'm not good at English, wish you you catch what I said And help me improve my English.
4+
5+
## tm.pagination -- A very simple and useful pagination in AngularJs
6+
On line demo [tm.pagination](http://demo.miaoyueyue.com/js/AngularJs-UI/demo/pagination.html)
7+
8+
// in the view
9+
<tm-pagination conf="paginationConf"></tm-pagination>
10+
11+
// in the controller
12+
$scope.paginationConf = {
13+
currentPage: 1,
14+
totalItems: 8000,
15+
itemsPerPage: 15,
16+
pagesLength: 15,
17+
perPageOptions: [10, 20, 30, 40, 50],
18+
rememberPerPage: 'perPageItems',
19+
onChange: function(){
20+
21+
}
22+
};
23+
24+
conf is a object, it has attributes like below:
25+
26+
* currentPage: Current page number, default 1
27+
* totalItems: Total number of items in all pages
28+
* itemsPerPage: number of items per page, default 15
29+
* onChange: when the pagination is change, it will excute the function
30+
* pagesLength: number for pagination size, default 9
31+
* perPageOptions: defind select how many items in a page, default [10, 15, 20, 30, 50]
32+
* rememberPerPage: use to remember how many items in a page select by user.
33+
34+
35+
36+
37+
38+
339

4-
AngularJs UI

demo/pagination.html

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<!doctype html>
2+
<html ng-app="myApp">
3+
<head>
4+
<meta charset="UTF-8">
5+
<link rel="stylesheet" href="../lib/bootstrap/3.2.0/css/bootstrap.min.css">
6+
<style>
7+
.page-list .pagination {float:left;}
8+
.page-list .pagination span {cursor: pointer;}
9+
.page-list .pagination .separate span{cursor: default; border-top:none;border-bottom:none;}
10+
.page-list .pagination .separate span:hover {background: none;}
11+
.page-list .page-total {float:left; margin: 25px 20px;}
12+
.page-list .page-total input, .page-list .page-total select{height: 26px; border: 1px solid #ddd;}
13+
.page-list .page-total input {width: 40px; padding-left:3px;}
14+
.page-list .page-total select {width: 50px;}
15+
</style>
16+
</head>
17+
<body ng-controller="testController">
18+
19+
<tm-pagination conf="paginationConf"></tm-pagination>
20+
21+
<script src="../lib/angularjs/1.2.22/angular.min.js"></script>
22+
<script src="../src/pagination/tm.pagination.js"></script>
23+
<script>
24+
angular.module('myApp', ['tm.pagination']).controller('testController', function($scope){
25+
/**
26+
* I'm not good at English, wish you you catch what I said And help me improve my English.
27+
*
28+
* A lightweight and useful pagination directive
29+
* conf is a object, it has attributes like below:
30+
*
31+
* currentPage: Current page number, default 1
32+
* totalItems: Total number of items in all pages
33+
* itemsPerPage: number of items per page, default 15
34+
* onChange: when the pagination is change, it will excute the function.
35+
*
36+
* pagesLength: number for pagination size, default 9
37+
* perPageOptions: defind select how many items in a page, default [10, 15, 20, 30, 50]
38+
* rememberPerPage: use to remember how many items in a page select by user.
39+
*
40+
*/
41+
$scope.paginationConf = {
42+
currentPage: 1,
43+
totalItems: 8000,
44+
itemsPerPage: 15,
45+
pagesLength: 15,
46+
perPageOptions: [10, 20, 30, 40, 50],
47+
rememberPerPage: 'perPageItems',
48+
onChange: function(){
49+
50+
}
51+
};
52+
})
53+
</script>
54+
</body>
55+
</html>

0 commit comments

Comments
 (0)