This repository has been archived by the owner on May 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pagination): plug into
ngModel
controller
Closes #1545 BREAKING CHANGE: Both `pagination` and `pager` are now integrated with `ngModelController`. * `page` is replaced from `ng-model`. * `on-select-page` is removed since `ng-change` can now be used. Before: <pagination page="current" on-select-page="changed(page)" ...></pagination> After: <pagination ng-model="current" ng-change="changed()" ...></pagination>
- Loading branch information
1 parent
27a642f
commit d65901c
Showing
6 changed files
with
71 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
<div ng-controller="PaginationDemoCtrl"> | ||
<h4>Default</h4> | ||
<pagination total-items="totalItems" page="currentPage"></pagination> | ||
<pagination boundary-links="true" total-items="totalItems" page="currentPage" class="pagination-sm" previous-text="‹" next-text="›" first-text="«" last-text="»"></pagination> | ||
<pagination direction-links="false" boundary-links="true" total-items="totalItems" page="currentPage"></pagination> | ||
<pagination direction-links="false" total-items="totalItems" page="currentPage" num-pages="smallnumPages"></pagination> | ||
<pagination total-items="totalItems" ng-model="currentPage" ng-change="pageChanged()"></pagination> | ||
<pagination boundary-links="true" total-items="totalItems" ng-model="currentPage" class="pagination-sm" previous-text="‹" next-text="›" first-text="«" last-text="»"></pagination> | ||
<pagination direction-links="false" boundary-links="true" total-items="totalItems" ng-model="currentPage"></pagination> | ||
<pagination direction-links="false" total-items="totalItems" ng-model="currentPage" num-pages="smallnumPages"></pagination> | ||
<pre>The selected page no: {{currentPage}}</pre> | ||
<button class="btn btn-info" ng-click="setPage(3)">Set current page to: 3</button> | ||
|
||
<hr /> | ||
<h4>Pager</h4> | ||
<pager total-items="totalItems" page="currentPage"></pager> | ||
<pager total-items="totalItems" ng-model="currentPage"></pager> | ||
|
||
<hr /> | ||
<h4>Limit the maximum visible buttons</h4> | ||
<pagination total-items="bigTotalItems" page="bigCurrentPage" max-size="maxSize" class="pagination-sm" boundary-links="true"></pagination> | ||
<pagination total-items="bigTotalItems" page="bigCurrentPage" max-size="maxSize" class="pagination-sm" boundary-links="true" rotate="false" num-pages="numPages"></pagination> | ||
<pagination total-items="bigTotalItems" ng-model="bigCurrentPage" max-size="maxSize" class="pagination-sm" boundary-links="true"></pagination> | ||
<pagination total-items="bigTotalItems" ng-model="bigCurrentPage" max-size="maxSize" class="pagination-sm" boundary-links="true" rotate="false" num-pages="numPages"></pagination> | ||
<pre>Page: {{bigCurrentPage}} / {{numPages}}</pre> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
var PaginationDemoCtrl = function ($scope) { | ||
$scope.totalItems = 64; | ||
$scope.currentPage = 4; | ||
$scope.maxSize = 5; | ||
|
||
|
||
$scope.setPage = function (pageNo) { | ||
$scope.currentPage = pageNo; | ||
}; | ||
|
||
$scope.pageChanged = function() { | ||
console.log('Page changed to: ' + $scope.currentPage); | ||
}; | ||
|
||
$scope.maxSize = 5; | ||
$scope.bigTotalItems = 175; | ||
$scope.bigCurrentPage = 1; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.