我找到了一些显示如何操作的链接,但我使用的是角1.3.13和angular-ui-bootstrap 0.13.0,我无法显示分页模板...
这是html:
<ul class="white">
<li ng-repeat="p in placed1">{{p}}</li>
</ul>
<pagination boundary-links="true"
max-size="3"
items-per-page="itemsPerPage"
total-items="placed.length"
ng-model="currentPage"
ng-change="pageChanged()">
</pagination>
这是脚本
$scope.placed1 = [];
$scope.placed2 = [];
$scope.itemsPerPage = 10;
$scope.currentPage = 1;
for (var i = 0; i < 30; i++) {
$scope.placed2.push("test " + i);
}
$scope.figureOutTodosToDisplay = function () {
var begin = (($scope.currentPage - 1) * $scope.itemsPerPage);
var end = begin + $scope.itemsPerPage;
$scope.placed1 = $scope.placed2.slice(begin, end);
};
$scope.figureOutTodosToDisplay();
$scope.pageChanged = function () {
$scope.figureOutTodosToDisplay();
};