From 39ccdbeeffd64af702151ef5c8c13ae22b503a35 Mon Sep 17 00:00:00 2001 From: Tim Whitman Date: Thu, 24 Apr 2014 10:57:41 -0700 Subject: [PATCH] Prevent watch on totalPages from clobbering non-first page initialization Fix for https://github.com/angular-ui/bootstrap/issues/2108 --- src/pagination/pagination.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pagination/pagination.js b/src/pagination/pagination.js index f022dce540..9d3a5f2f96 100644 --- a/src/pagination/pagination.js +++ b/src/pagination/pagination.js @@ -53,10 +53,10 @@ angular.module('ui.bootstrap.pagination', []) $scope.totalPages = self.calculateTotalPages(); }); - $scope.$watch('totalPages', function(value) { + $scope.$watch('totalPages', function(value, oldvalue ) { setNumPages($scope.$parent, value); // Readonly variable - if ( $scope.page > value ) { + if ( $scope.page > value && value != oldvalue ) { $scope.selectPage(value); } else { ngModelCtrl.$render();