我正試圖在角度/引導站點上實現分頁。我有數據顯示每頁正確的#行,我有角度分頁顯示正確的頁數......但是,如果我能找到任何地方告訴我如何使用分頁來刷新我的數據頁面#被點擊...?! {{currentPage}}正在更新,但不知道如何讓它調用getPresentations來更新列表。角度分頁 - 更新數據onclick
<div>
{{noOfPages}} {{currentPage}} {{maxSize}}
<pagination num-pages="noOfPages" current-page="currentPage"></pagination>
</div>
<script type="text/javascript">
angular.module('app', ['ui', 'shared', 'ui.bootstrap']).controller('AppCtl', function ($scope, $http, $window) {
var mvc = $window.MVC;
$scope.noOfPages = 0;
$scope.currentPage = 1;
$scope.maxSize = 5;
$scope.getPresentations = function() {
$http.get(mvc.base + "API/Presentations?page=" + $scope.currentPage + "&itemsPerPage=10")
.success(function (result) {
$scope.presentations = result.Items;
$scope.noOfPages = result.TotalPages;
$scope.currentPage = result.Page;
})
.error(function (result, status) {
$scope.newModal.errors = mvc.getApiErrors(status, result);
});
};
$scope.getPresentations();
});
</script>
謝謝!我知道它不會太多......令我感到厭煩的是,他們沒有在文檔中包含這部分內容。 – NikZ 2013-02-26 15:22:29
感謝您的回答!在「pageChanged」示例中,$ scope.watchPage = newPage的用途是什麼? – standingwave 2014-03-14 07:48:33
我要瘋了,因爲在來到這裏之前我已經嘗試了這兩種方法,但都沒有工作:( – Dustin 2014-08-14 16:58:29