我正在使用 ui-bootstrap 分页,当所有结果都包含在单个页面上时,我想隐藏分页控件。正如您在下图中看到的,只有一页并且控件仍然显示。对于 ui-bootstrap 团队来说,将其本地包含在框架中似乎是常识。所以我想可能有一种方法可以轻松做到这一点,但我不知道从哪里开始。
这是 Controller 中的代码:
$scope.itemsPerPage = 5;
$scope.currentPage = 1;
$scope.maxSize = 4;
这是 HTML:
<div ng-controller="observedCars">
<div ng-repeat="obv in observed['Observed CARs'] | startFrom:(currentPage - 1) * itemsPerPage | limitTo: itemsPerPage">
<div class="carId">{{ obv['Display Name'] }}</div>
</div>
<ul uib-pagination total-items="observed['Observed CARs'].length" ng-model="currentPage" items-per-page="itemsPerPage" ng-change="pageChanged()" max-size="maxSize"></ul>
</div>
我希望有人已经做过同样的事情并且可以提供帮助。
提前致谢。
最佳答案
使用 data-ng-show 作为 ul 标签,例如
<ul uib-pagination total-items="observed['Observed CARs'].length" data-ng-show="observed['Observed CARs'].length > itemsPerPage" ng-model="currentPage" items-per-page="itemsPerPage" ng-change="pageChanged()" max-size="maxSize"></ul>
关于javascript - AngularJS - ui-bootstrap 分页。隐藏单页按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39172551/