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', [])
4646 }
4747 } ;
4848
49+ $scope . $watch ( 'page' , function ( ) {
50+ self . render ( ) ;
51+ } ) ;
52+
4953 $scope . $watch ( 'totalItems' , function ( ) {
5054 $scope . totalPages = self . calculateTotalPages ( ) ;
5155 } ) ;
@@ -59,10 +63,6 @@ angular.module('ui.bootstrap.pagination', [])
5963 self . render ( ) ;
6064 }
6165 } ) ;
62-
63- $scope . $watch ( 'page' , function ( ) {
64- self . render ( ) ;
65- } ) ;
6666} ] )
6767
6868. constant ( 'paginationConfig' , {
Original file line number Diff line number Diff line change @@ -95,6 +95,14 @@ describe('pagination directive', function () {
9595 expect ( getPaginationEl ( - 1 ) . text ( ) ) . toBe ( 'Next' ) ;
9696 } ) ;
9797
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+
98106 describe ( '`items-per-page`' , function ( ) {
99107 beforeEach ( inject ( function ( ) {
100108 $rootScope . perpage = 5 ;
You can’t perform that action at this time.
0 commit comments