Skip to content

Commit 8ae1a16

Browse files
committed
Addressed review issues
1 parent acbc77e commit 8ae1a16

File tree

3 files changed

+15
-27
lines changed

3 files changed

+15
-27
lines changed

src/pagination/pagination.component.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @param {number} pageNumber The current page number
77
* @param {number} numTotalItems The total number of items in the data set. When a filter is applied, update the <code>numTotalItems</code>
88
* accordingly.
9-
* @param {number[]} pageSizeIncrements (optional) Page size increments for the 'per page' dropdown. If not
9+
* @param {Array<Number>} pageSizeIncrements (optional) Page size increments for the 'per page' dropdown. If not
1010
* specified, the default values are: [5, 10, 20, 40, 80, 100]
1111
* @param {number} pageSize (optional) The initial page size to use. If not specified, the default will be
1212
* the first increment in the <code>pageSizeIncrements</code> array.
@@ -41,7 +41,7 @@
4141
</div>
4242
</file>
4343
<file name="script.js">
44-
angular.module( 'patternfly.pagination').controller( 'PageCtrl', function( $scope, PaginationService ) {
44+
angular.module( 'patternfly.pagination').controller( 'PageCtrl', function( $scope ) {
4545
$scope.pageSize = 10;
4646
$scope.pageNumber = 1;
4747
@@ -94,6 +94,11 @@ angular.module('patternfly.pagination').component('pfPagination', {
9494

9595
ctrl.onPageNumberChange = function () {
9696
ctrl.pageNumber = parseInt(ctrl.pageNumber, 10);
97+
if (ctrl.pageNumber > ctrl.lastPageNumber) {
98+
ctrl.pageNumber = ctrl.lastPageNumber;
99+
} else if (ctrl.pageNumber < 1) {
100+
ctrl.pageNumber = 1;
101+
}
97102
};
98103

99104
ctrl.gotoFirstPage = function () {

src/pagination/pagination.module.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,11 @@
55
* Pagination module for patternfly.
66
*
77
*/
8-
angular.module('patternfly.pagination', ['ui.bootstrap']);
8+
angular.module('patternfly.pagination', ['ui.bootstrap'])
9+
.filter('startFrom', function () {
10+
'use strict';
11+
return function (input, start) {
12+
start = parseInt(start, 10);
13+
return input.slice(start);
14+
};
15+
});

src/pagination/pagination.service.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)