From 79513cd31132bf04ae5305acf21a97550d609b03 Mon Sep 17 00:00:00 2001 From: Michael Bromley Date: Thu, 27 Aug 2015 09:42:36 +0200 Subject: [PATCH] Release 0.8.4 Fix tracking bug in pagination controls. --- bower.json | 2 +- dirPagination.js | 14 +++++++++++++- dirPagination.tpl.html | 4 ++-- package.js | 2 +- package.json | 2 +- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/bower.json b/bower.json index 9e16663..ebafec7 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angularUtils-pagination", - "version": "0.8.3", + "version": "0.8.4", "homepage": "https://github.com/michaelbromley/angularUtils/tree/master/src/directives/pagination", "authors": [ "Michael Bromley " diff --git a/dirPagination.js b/dirPagination.js index e9de7ee..6ac9e91 100644 --- a/dirPagination.js +++ b/dirPagination.js @@ -210,7 +210,7 @@ } function dirPaginationControlsTemplateInstaller($templateCache) { - $templateCache.put('angularUtils.directives.dirPagination.template', ''); + $templateCache.put('angularUtils.directives.dirPagination.template', ''); } function dirPaginationControlsDirective(paginationService, paginationTemplate) { @@ -298,6 +298,18 @@ } }; + /** + * Custom "track by" function which allows for duplicate "..." entries on long lists, + * yet fixes the problem of wrongly-highlighted links which happens when using + * "track by $index" - see https://github.com/michaelbromley/angularUtils/issues/153 + * @param id + * @param index + * @returns {string} + */ + scope.tracker = function(id, index) { + return id + '_' + index; + }; + function goToPage(num) { if (paginationService.isRegistered(paginationId) && isValidPageNumber(num)) { scope.pages = generatePagesArray(num, paginationService.getCollectionLength(paginationId), paginationService.getItemsPerPage(paginationId), paginationRange); diff --git a/dirPagination.tpl.html b/dirPagination.tpl.html index 558aa20..db98d4c 100644 --- a/dirPagination.tpl.html +++ b/dirPagination.tpl.html @@ -1,11 +1,11 @@ -