From 471f9664757593f285f3242acf0af12bf7be2325 Mon Sep 17 00:00:00 2001 From: Michael Bromley Date: Mon, 13 Oct 2014 11:53:32 +0200 Subject: [PATCH] Bump to v0.2.6 See release notes for changes --- bower.json | 2 +- dirPagination.js | 13 +++++++------ dirPagination.tpl.html | 8 ++++---- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/bower.json b/bower.json index e0fd6df..8e3c094 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angularUtils-pagination", - "version": "0.2.5", + "version": "0.2.6", "homepage": "https://github.com/michaelbromley/angularUtils/tree/master/src/directives/pagination", "authors": [ "Michael Bromley " diff --git a/dirPagination.js b/dirPagination.js index 7881239..42b5cb6 100644 --- a/dirPagination.js +++ b/dirPagination.js @@ -36,7 +36,7 @@ module.directive('dirPaginate', ['$compile', '$parse', '$timeout', 'paginationService', function($compile, $parse, $timeout, paginationService) { return { terminal: true, - compile: function(element, attrs){ + compile: function dirPaginationCompileFn(element, attrs){ attrs.$set('ngRepeat', attrs.dirPaginate); // Add ng-repeat to the dom element element.removeAttr(attrs.$attr.dirPaginate); // Remove the dir-paginate attribute to prevent infinite recursion of compilation @@ -51,7 +51,7 @@ var itemsPerPageFilterRemoved = match[2].replace(filterPattern, ''); var collectionGetter = $parse(itemsPerPageFilterRemoved); - return function(scope, element, attrs){ + return function dirPaginationLinkFn(scope, element, attrs){ var paginationId; var compiled = $compile(element); // we manually compile the element again, as we have now swapped dir-paginate for an ng-repeat @@ -92,7 +92,7 @@ compiled(scope); }; } - }; + }; }]); module.directive('dirPaginationControls', ['paginationService', function(paginationService) { @@ -204,8 +204,10 @@ scope.$watch(function() { return paginationService.getCurrentPage(paginationId); - }, function(currentPage) { - goToPage(currentPage); + }, function(currentPage, previousPage) { + if (currentPage != previousPage) { + goToPage(currentPage); + } }); scope.setCurrent = function(num) { @@ -272,7 +274,6 @@ module.service('paginationService', function() { var instances = {}; var lastRegisteredInstance; - this.paginationDirectiveInitialized = false; this.registerInstance = function(instanceId) { if (typeof instances[instanceId] === 'undefined') { diff --git a/dirPagination.tpl.html b/dirPagination.tpl.html index cdb298d..558aa20 100644 --- a/dirPagination.tpl.html +++ b/dirPagination.tpl.html @@ -2,15 +2,15 @@
  • «
  • -
  • - +
  • +
  • {{ pageNumber }}
  • -
  • - +
  • +
  • »