Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let it work with Bootstrap4 #478

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions src/directives/pagination/dirPagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
// See https://github.com/michaelbromley/angularUtils/issues/233
// Adding the '_' as a prefix resolves an issue where paginationId might be have a digit as its first char
// See https://github.com/michaelbromley/angularUtils/issues/400
var defaultCurrentPage = '_' + (paginationId + '__currentPage').replace(/\W/g, '_');
var defaultCurrentPage = (paginationId + '__currentPage').replace(/\W/g, '_');
scope[defaultCurrentPage] = 1;
currentPageGetter = $parse(defaultCurrentPage);
}
Expand All @@ -224,7 +224,24 @@
}

function dirPaginationControlsTemplateInstaller($templateCache) {
$templateCache.put('angularUtils.directives.dirPagination.template', '<ul class="pagination" ng-if="1 < pages.length || !autoHide"><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 }"><a href="" ng-click="setCurrent(pagination.current - 1)">&lsaquo;</a></li><li ng-repeat="pageNumber in pages track by tracker(pageNumber, $index)" ng-class="{ active : pagination.current == pageNumber, disabled : pageNumber == \'...\' || ( ! autoHide && pages.length === 1 ) }"><a href="" ng-click="setCurrent(pageNumber)">{{ pageNumber }}</a></li><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></li></ul>');
$templateCache.put('angularUtils.directives.dirPagination.template',
'<ul class="pagination" ng-if="1 < pages.length || !autoHide">' +
'<li class="page-item" ng-if="boundaryLinks" ng-class="{ disabled : pagination.current == 1 }">' +
'<a class="page-link" href="" ng-click="setCurrent(1)">&laquo;</a>' +
'</li>' +
'<li class="page-item" ng-if="directionLinks" ng-class="{ disabled : pagination.current == 1 }">' +
'<a class="page-link" href="" ng-click="setCurrent(pagination.current - 1)">&lsaquo;</a>' +
'</li>' +
'<li class="page-item" ng-repeat="pageNumber in pages track by tracker(pageNumber, $index)" ng-class="{ active : pagination.current == pageNumber, disabled : pageNumber == \'...\' || ( ! autoHide && pages.length === 1 ) }">' +
'<a class="page-link" href="" ng-click="setCurrent(pageNumber)">{{ pageNumber }}</a>' +
'</li>' +
'<li class="page-item" ng-if="directionLinks" ng-class="{ disabled : pagination.current == pagination.last }">' +
'<a class="page-link" href="" ng-click="setCurrent(pagination.current + 1)">&rsaquo;</a>' +
'</li>' +
'<li class="page-item" ng-if="boundaryLinks" ng-class="{ disabled : pagination.current == pagination.last }">' +
'<a class="page-link" href="" ng-click="setCurrent(pagination.last)">&raquo;</a>' +
'</li>' +
'</ul>');
}

function dirPaginationControlsDirective(paginationService, paginationTemplate) {
Expand Down