我有桌子(以我的嵌入形式),我想添加分页,这里我添加了分页功能div:
<div data-pagination="" data-num-pages="numOfPages()"
data-current-page="curPage" data-max-size="maxSize"
data-boundary-links="true"></div>
我在javscript中有相关代码
//pagination
$scope.curPage = 1,
$scope.itemsPerPage = 3,
$scope.maxSize = 5;
items = answer;
$scope.numOfPages = function () {
return Math.ceil(answer.length / $scope.itemsPerPage);
};
$scope.$watch('curPage + numPerPage', function() {
var begin = (($scope.curPage - 1) * $scope.itemsPerPage);
var end = begin + $scope.itemsPerPage;
console.log(begin);
console.log(end);
console.log( answer.slice(begin, end));
$scope.filteredItems = answer.slice(begin, end);
});
我应该收到这样的回复: 但相反,我根本看不到分页(p.s我在控制台中看不到任何错误) 我应该改变什么才能使分页正常工作?