即時得到與UI的引導分頁未知的提供了一個錯誤:startFromFilterProviderAngularJS - 用戶界面,引導分頁錯誤
這裏是我的控制器代碼:
function observedCars($scope, $http, API, CarDetailService, $state) {
$http.get(API + '/car/?observed=true&offset=0&page_size=20').
success(function(data) {
$scope.observed = data;
});
$scope.pageSize = 5;
$scope.currentPage = 1;
$scope.selectCar = function(carId) {
CarDetailService.setCar(carId);
$state.go('taskDetails');
};
}
下面是HTML:
<div ng-controller="observedCars">
<div ng-repeat="obv in observed['Observed CARs'] | startFrom:(currentPage - 1) * pageSize | limitTo: pageSize" class="myCar">
<div class="carId">{{ obv['Display Name'] }}</div>
<div class="title">{{ obv['Project Title'] }}</div>
<div class="status"> {{obv.Status}} </div>
<h4><u>Current Approver</u></h4>
<div class="currApp dont-break-out">{{obv['Current Approver']}}</div>
<h4><u>Amount</u></h4>
<div class="modified">${{obv.Amount | number:2}}</div>
<div class="carBtnWrap">
<div class="viewCar"><a ng-click="selectCar(obv['CAR ID'])">View Details</a></div>
</div>
</div>
<ul uib-pagination total-items="observed['Observed CARs'].length" ng-model="currentPage" items-per-page="pageSize"></ul>
</div>
另外我應該提到它確實在「uib-pagination」按鈕部分中顯示了正確的按鈕數量。所以適量的頁面加載不會導致錯誤的數據。
我怎樣才能解決這個
感謝
豎起大拇指!謝謝。 – agon024