Skip to content

Commit 471f966

Browse files
Bump to v0.2.6
See release notes for changes
1 parent 39cca44 commit 471f966

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angularUtils-pagination",
3-
"version": "0.2.5",
3+
"version": "0.2.6",
44
"homepage": "https://github.com/michaelbromley/angularUtils/tree/master/src/directives/pagination",
55
"authors": [
66
"Michael Bromley <[email protected]>"

dirPagination.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
module.directive('dirPaginate', ['$compile', '$parse', '$timeout', 'paginationService', function($compile, $parse, $timeout, paginationService) {
3737
return {
3838
terminal: true,
39-
compile: function(element, attrs){
39+
compile: function dirPaginationCompileFn(element, attrs){
4040
attrs.$set('ngRepeat', attrs.dirPaginate); // Add ng-repeat to the dom element
4141
element.removeAttr(attrs.$attr.dirPaginate); // Remove the dir-paginate attribute to prevent infinite recursion of compilation
4242

@@ -51,7 +51,7 @@
5151
var itemsPerPageFilterRemoved = match[2].replace(filterPattern, '');
5252
var collectionGetter = $parse(itemsPerPageFilterRemoved);
5353

54-
return function(scope, element, attrs){
54+
return function dirPaginationLinkFn(scope, element, attrs){
5555
var paginationId;
5656
var compiled = $compile(element); // we manually compile the element again, as we have now swapped dir-paginate for an ng-repeat
5757

@@ -92,7 +92,7 @@
9292
compiled(scope);
9393
};
9494
}
95-
};
95+
};
9696
}]);
9797

9898
module.directive('dirPaginationControls', ['paginationService', function(paginationService) {
@@ -204,8 +204,10 @@
204204

205205
scope.$watch(function() {
206206
return paginationService.getCurrentPage(paginationId);
207-
}, function(currentPage) {
208-
goToPage(currentPage);
207+
}, function(currentPage, previousPage) {
208+
if (currentPage != previousPage) {
209+
goToPage(currentPage);
210+
}
209211
});
210212

211213
scope.setCurrent = function(num) {
@@ -272,7 +274,6 @@
272274
module.service('paginationService', function() {
273275
var instances = {};
274276
var lastRegisteredInstance;
275-
this.paginationDirectiveInitialized = false;
276277

277278
this.registerInstance = function(instanceId) {
278279
if (typeof instances[instanceId] === 'undefined') {

dirPagination.tpl.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<li ng-if="boundaryLinks" ng-class="{ disabled : pagination.current == 1 }">
33
<a href="" ng-click="setCurrent(1)">&laquo;</a>
44
</li>
5-
<li ng-if="directionLinks" ng-class="{ disabled : pagination.current == 1 }" class="ng-scope">
6-
<a href="" ng-click="setCurrent(pagination.current - 1)" class="ng-binding">&lsaquo;</a>
5+
<li ng-if="directionLinks" ng-class="{ disabled : pagination.current == 1 }">
6+
<a href="" ng-click="setCurrent(pagination.current - 1)">&lsaquo;</a>
77
</li>
88
<li ng-repeat="pageNumber in pages track by $index" ng-class="{ active : pagination.current == pageNumber, disabled : pageNumber == '...' }">
99
<a href="" ng-click="setCurrent(pageNumber)">{{ pageNumber }}</a>
1010
</li>
1111

12-
<li ng-if="directionLinks" ng-class="{ disabled : pagination.current == pagination.last }" class="ng-scope">
13-
<a href="" ng-click="setCurrent(pagination.current + 1)" class="ng-binding">&rsaquo;</a>
12+
<li ng-if="directionLinks" ng-class="{ disabled : pagination.current == pagination.last }">
13+
<a href="" ng-click="setCurrent(pagination.current + 1)">&rsaquo;</a>
1414
</li>
1515
<li ng-if="boundaryLinks" ng-class="{ disabled : pagination.current == pagination.last }">
1616
<a href="" ng-click="setCurrent(pagination.last)">&raquo;</a>

0 commit comments

Comments
 (0)