File tree 2 files changed +12
-1
lines changed 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ and for rendering page numbers:
103
103
104
104
``` html
105
105
<span ng-repeat =" n in [] | paginationRange: pg.pages" >
106
- <button ng-click =" pagination.toPageId(n )" >{{n}}</button >
106
+ <button ng-click =" pg.set({start: pg.forPage(n)} )" >{{n}}</button >
107
107
<span >
108
108
```
109
109
Original file line number Diff line number Diff line change @@ -111,6 +111,17 @@ paginationModule.factory("Pagination", function(){
111
111
pagination . prototype . last = function ( ) {
112
112
return Math . floor ( ( this . pages - 1 ) * this . limit )
113
113
}
114
+ /**
115
+ * Get the starting point of a specific page
116
+ * @param page
117
+ * @returns {number }
118
+ */
119
+ pagination . prototype . forPage = function ( page ) {
120
+ page = parseInt ( page , 10 ) || 1
121
+ if ( page < 1 ) page = 1
122
+ if ( page > this . pages ) page = this . pages
123
+ return ( page - 1 ) * this . limit
124
+ }
114
125
/**
115
126
* Set the properties of the pagination
116
127
* @param obj
You can’t perform that action at this time.
0 commit comments