This repository was archived by the owner on May 29, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +26
-4
lines changed Expand file tree Collapse file tree 3 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,9 @@ angular.module('ui.bootstrap.pagination', [])
7
7
numPages : '=' ,
8
8
currentPage : '=' ,
9
9
maxSize : '=' ,
10
- onSelectPage : '&'
10
+ onSelectPage : '&' ,
11
+ nextText : '@' ,
12
+ previousText : '@'
11
13
} ,
12
14
templateUrl : 'template/pagination/pagination.html' ,
13
15
replace : true ,
Original file line number Diff line number Diff line change @@ -190,4 +190,24 @@ describe('pagination directive with max size option', function () {
190
190
expect ( $rootScope . maxSize ) . toBe ( 15 ) ;
191
191
} ) ;
192
192
193
- } ) ;
193
+ } ) ;
194
+
195
+ describe ( 'pagination custom' , function ( ) {
196
+ var $rootScope , element ;
197
+ beforeEach ( module ( 'ui.bootstrap.pagination' ) ) ;
198
+ beforeEach ( module ( 'template/pagination/pagination.html' ) ) ;
199
+ beforeEach ( inject ( function ( _$compile_ , _$rootScope_ ) {
200
+ $compile = _$compile_ ;
201
+ $rootScope = _$rootScope_ ;
202
+ $rootScope . numPages = 5 ;
203
+ $rootScope . currentPage = 3 ;
204
+ element = $compile ( '<pagination previous-text="<<" next-text=">>" num-pages="numPages" current-page="currentPage"></pagination>' ) ( $rootScope ) ;
205
+ $rootScope . $digest ( ) ;
206
+ } ) ) ;
207
+
208
+ it ( 'should change paging text from attribute' , function ( ) {
209
+ expect ( element . find ( 'li' ) . eq ( 0 ) . text ( ) ) . toBe ( '<<' ) ;
210
+ expect ( element . find ( 'li' ) . eq ( - 1 ) . text ( ) ) . toBe ( '>>' ) ;
211
+ } ) ;
212
+
213
+ } ) ;
Original file line number Diff line number Diff line change 1
1
< div class ="pagination "> < ul >
2
- < li ng-class ="{disabled: noPrevious()} "> < a ng-click ="selectPrevious() "> Previous</ a > </ li >
2
+ < li ng-class ="{disabled: noPrevious()} "> < a ng-click ="selectPrevious() "> {{previousText || ' Previous'}} </ a > </ li >
3
3
< li ng-repeat ="page in pages " ng-class ="{active: isActive(page)} "> < a ng-click ="selectPage(page) "> {{page}}</ a > </ li >
4
- < li ng-class ="{disabled: noNext()} "> < a ng-click ="selectNext() "> Next</ a > </ li >
4
+ < li ng-class ="{disabled: noNext()} "> < a ng-click ="selectNext() "> {{nextText || ' Next'}} </ a > </ li >
5
5
</ ul >
6
6
</ div >
You can’t perform that action at this time.
0 commit comments