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(pager): move to separate component
- Separate pager into its own component Closes #4935
- Loading branch information
Showing
9 changed files
with
74 additions
and
68 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<div ng-controller="PagerDemoController"> | ||
<h4>Pager</h4> | ||
<uib-pager total-items="totalItems" ng-model="currentPage"></uib-pager> | ||
</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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
angular.module('ui.bootstrap.demo').controller('PagerDemoCtrl', function($scope) { | ||
$scope.totalItems = 64; | ||
$scope.currentPage = 4; | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
A lightweight pager directive that is focused on providing previous/next paging functionality | ||
|
||
### Pager Settings ### | ||
|
||
Settings can be provided as attributes in the `<uib-pager>` or globally configured through the `uibPagerConfig`. | ||
For `ng-model`, `total-items`, `items-per-page` and `num-pages` see pagination settings. Other settings are: | ||
|
||
* `align` | ||
_(Default: true)_ : | ||
Whether to align each link to the sides. | ||
|
||
* `previous-text` | ||
_(Default: '« Previous')_ : | ||
Text for Previous button. | ||
|
||
* `next-text` | ||
_(Default: 'Next »')_ : | ||
Text for Next button. | ||
|
||
* `template-url` | ||
_(Default: 'template/pagination/pager.html') : | ||
Override the template for the component with a custom provided template | ||
|
||
* `ng-disabled` <i class="glyphicon glyphicon-eye-open"></i> | ||
: | ||
Used to disable the pager component |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
angular.module('ui.bootstrap.pager', ['ui.bootstrap.pagination']) | ||
|
||
.constant('uibPagerConfig', { | ||
itemsPerPage: 10, | ||
previousText: '« Previous', | ||
nextText: 'Next »', | ||
align: true | ||
}) | ||
|
||
.directive('uibPager', ['uibPagerConfig', function(pagerConfig) { | ||
return { | ||
restrict: 'EA', | ||
scope: { | ||
totalItems: '=', | ||
previousText: '@', | ||
nextText: '@', | ||
ngDisabled: '=' | ||
}, | ||
require: ['uibPager', '?ngModel'], | ||
controller: 'UibPaginationController', | ||
controllerAs: 'pagination', | ||
templateUrl: function(element, attrs) { | ||
return attrs.templateUrl || 'uib/template/pager/pager.html'; | ||
}, | ||
replace: true, | ||
link: function(scope, element, attrs, ctrls) { | ||
var paginationCtrl = ctrls[0], ngModelCtrl = ctrls[1]; | ||
|
||
if (!ngModelCtrl) { | ||
return; // do nothing if no ng-model | ||
} | ||
|
||
scope.align = angular.isDefined(attrs.align) ? scope.$parent.$eval(attrs.align) : pagerConfig.align; | ||
paginationCtrl.init(ngModelCtrl, pagerConfig); | ||
} | ||
}; | ||
}]); |
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
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
File renamed without changes.