Skip to content

Commit

Permalink
Bump to v0.2.6
Browse files Browse the repository at this point in the history
See release notes for changes
  • Loading branch information
michaelbromley committed Oct 13, 2014
1 parent 39cca44 commit 471f966
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -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 <michael@michaelbromley.co.uk>"
Expand Down
13 changes: 7 additions & 6 deletions dirPagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -92,7 +92,7 @@
compiled(scope);
};
}
};
};
}]);

module.directive('dirPaginationControls', ['paginationService', function(paginationService) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -272,7 +274,6 @@
module.service('paginationService', function() {
var instances = {};
var lastRegisteredInstance;
this.paginationDirectiveInitialized = false;

this.registerInstance = function(instanceId) {
if (typeof instances[instanceId] === 'undefined') {
Expand Down
8 changes: 4 additions & 4 deletions dirPagination.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<li ng-if="boundaryLinks" ng-class="{ disabled : pagination.current == 1 }">
<a href="" ng-click="setCurrent(1)">&laquo;</a>
</li>
<li ng-if="directionLinks" ng-class="{ disabled : pagination.current == 1 }" class="ng-scope">
<a href="" ng-click="setCurrent(pagination.current - 1)" class="ng-binding">&lsaquo;</a>
<li ng-if="directionLinks" ng-class="{ disabled : pagination.current == 1 }">
<a href="" ng-click="setCurrent(pagination.current - 1)">&lsaquo;</a>
</li>
<li ng-repeat="pageNumber in pages track by $index" ng-class="{ active : pagination.current == pageNumber, disabled : pageNumber == '...' }">
<a href="" ng-click="setCurrent(pageNumber)">{{ pageNumber }}</a>
</li>

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

0 comments on commit 471f966

Please sign in to comment.