Last active
December 20, 2015 21:39
-
-
Save callblueday/6199446 to your computer and use it in GitHub Desktop.
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
//---- controller.js ---- | |
$scope.pageNum = null; | |
$scope.currentPage = 0; | |
$scope.pageSize = 10; | |
/* get previous page data */ | |
$scope.getPrevPage = function() { | |
$scope.currentPage = $scope.currentPage - 1; | |
} | |
/* get next page data */ | |
$scope.getNextPage = function() { | |
if(($scope.currentPage + 1) === ($scope.pageNum - 1)) { | |
$scope.getPageListStartData(); | |
} | |
$scope.currentPage = $scope.currentPage + 1; | |
} | |
//---- html ---- | |
<div class="pagination pagination-small pagination-centered" id="pager"> | |
<button class="btn btn-small" ng-disabled="currentPage == 0" ng-click="getPrevPage()"> | |
«上一页 | |
</button> | |
{{currentPage+1}}/{{pageNum}} | |
<button class="btn btn-small" ng-disabled="currentPage >= pageNum - 1" ng-click="getNextPage()"> | |
下一页» | |
</button> | |
</div> | |
//---- filter ---- | |
angular.module('qlinkListFilter', []) | |
.filter('startFrom', function() { | |
return function(input, start) { | |
if(input) { | |
start = +start; //parse to int | |
return input.slice(start); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment