我有一个分页代码我的分页栏现在显示2个按钮我正面临一个问题,当用户进入第5页时,它只显示名为5的单个按钮,因为我的数据进入奇数页面,我希望我的分页栏来处理这个:第1,2页一次,当用户点击下一个它应该看起来像第2,3页一次,如果5是最后一页它应该显示我按钮如4,5和按钮5突出显示,我不知道该怎么做才能帮助我?
我的分页代码:
<pagination page="currentPage" max-size="maxSize" total-items="totalItems"
items-per-page="entryLimit" boundary-links="true" rotate="false" style="cursor:pointer">
</pagination>
我的控制器逻辑:
$scope.currentPage = 1;
$scope.maxSize = 2;
$scope.totalLeadItems = $scope.finalLeadData.dataval;
$scope.totalItems = $scope.finalLeadData.dataval.length;
$scope.entryLimit = 2; // items per page
$scope.noOfPages = Math.ceil($scope.totalItems / $scope.entryLimit);
$scope.search = function (item){
//console.log(item.LEAD_NM);
return !! ((angular.lowercase(item.LEAD_NM).indexOf($scope.search.LEAD || '') !== -1 || angular.lowercase(item.LEAD_MBL).indexOf($scope.search.LEAD || '') !== -1));
};
//$watch search to update pagination
$scope.$watch('search.LEAD', function (newVal) {
$scope.filtered = filterFilter($scope.finalLeadData.dataval, newVal);
$scope.totalItems = $scope.filtered.length;
$scope.noOfPages = Math.ceil($scope.totalItems / $scope.entryLimit);
$scope.currentPage = 1;
}, true);