diff --git a/bower.json b/bower.json index bf80e57..5887b17 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angularUtils-pagination", - "version": "0.9.4", + "version": "0.10.0", "homepage": "https://github.com/michaelbromley/angularUtils/tree/master/src/directives/pagination", "authors": [ "Michael Bromley " diff --git a/dirPagination.js b/dirPagination.js index 904b042..f4194f4 100644 --- a/dirPagination.js +++ b/dirPagination.js @@ -238,7 +238,9 @@ if (!paginationService.isRegistered(paginationId) && !paginationService.isRegistered(rawId)) { var idMessage = (paginationId !== DEFAULT_ID) ? ' (id: ' + paginationId + ') ' : ' '; - console.warn('Pagination directive: the pagination controls' + idMessage + 'cannot be used without the corresponding pagination directive, which was not found at link time.'); + if (window.console) { + console.warn('Pagination directive: the pagination controls' + idMessage + 'cannot be used without the corresponding pagination directive, which was not found at link time.'); + } } if (!scope.maxSize) { scope.maxSize = 9; } @@ -309,13 +311,19 @@ function goToPage(num) { if (paginationService.isRegistered(paginationId) && isValidPageNumber(num)) { + var oldPageNumber = scope.pagination.current; + scope.pages = generatePagesArray(num, paginationService.getCollectionLength(paginationId), paginationService.getItemsPerPage(paginationId), paginationRange); scope.pagination.current = num; updateRangeValues(); - // if a callback has been set, then call it with the page number as an argument + // if a callback has been set, then call it with the page number as the first argument + // and the previous page number as a second argument if (scope.onPageChange) { - scope.onPageChange({ newPageNumber : num }); + scope.onPageChange({ + newPageNumber : num, + oldPageNumber : oldPageNumber + }); } } } diff --git a/package.js b/package.js index beb31e3..d8afdba 100644 --- a/package.js +++ b/package.js @@ -1,7 +1,7 @@ Package.describe({ name: 'angularutils:pagination', summary: 'Magical automatic pagination for anything in AngularJS', - version: '0.9.4', + version: '0.10.0', git: 'https://github.com/michaelbromley/angularUtils-pagination' }); diff --git a/package.json b/package.json index 4b79050..c039b01 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-utils-pagination", - "version": "0.9.4", + "version": "0.10.0", "description": "Magical automatic pagination for anything in AngularJS", "main": "index.js", "scripts": {