File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,10 @@ angular.module('ui.bootstrap.pagination', [])
46
46
}
47
47
} ;
48
48
49
+ $scope . $watch ( 'page' , function ( ) {
50
+ self . render ( ) ;
51
+ } ) ;
52
+
49
53
$scope . $watch ( 'totalItems' , function ( ) {
50
54
$scope . totalPages = self . calculateTotalPages ( ) ;
51
55
} ) ;
@@ -59,10 +63,6 @@ angular.module('ui.bootstrap.pagination', [])
59
63
self . render ( ) ;
60
64
}
61
65
} ) ;
62
-
63
- $scope . $watch ( 'page' , function ( ) {
64
- self . render ( ) ;
65
- } ) ;
66
66
} ] )
67
67
68
68
. constant ( 'paginationConfig' , {
Original file line number Diff line number Diff line change @@ -95,6 +95,14 @@ describe('pagination directive', function () {
95
95
expect ( getPaginationEl ( - 1 ) . text ( ) ) . toBe ( 'Next' ) ;
96
96
} ) ;
97
97
98
+ it ( 'does not change the current page when `total-items` changes but is valid' , function ( ) {
99
+ $rootScope . currentPage = 1 ;
100
+ $rootScope . total = 18 ; // 2 pages
101
+ $rootScope . $digest ( ) ;
102
+
103
+ expect ( $rootScope . currentPage ) . toBe ( 1 ) ;
104
+ } ) ;
105
+
98
106
describe ( '`items-per-page`' , function ( ) {
99
107
beforeEach ( inject ( function ( ) {
100
108
$rootScope . perpage = 5 ;
You can’t perform that action at this time.
0 commit comments