我目前正在显示一个包含基于承诺的数据的列表,我希望对其进行分页。它可以在一个分页控件中正常工作,但是当我在列表底部包含分页时,我得到Error: transition superseded
。
我的代码目前看起来像这样;
HTML模板:
<div class="bq-pagination">
<ul dir-pagination-controls
on-page-change="pageChanged(pagination.currentPage, false)"
max-size="pagination.maxSize"
direction-links="true">
</ul>
</div>
<hr />
<div class="item-list">
<div class="row item-list-row auction-list"
dir-paginate="a in auctions |
orderBy: selectedSort.sort : selectedSort.reverse |
itemsPerPage: pagination.itemsPerPage"
current-page="pagination.currentPage">
{{view-stuff}}
</div>
</div>
<div class="bq-pagination">
<ul dir-pagination-controls
on-page-change="pageChanged(pagination.currentPage, false)"
max-size="pagination.maxSize"
direction-links="true">
</ul>
</div>
控制器位于指令内,如下所示:
(function () {
'use strict';
angular
.module('bqWeb')
.directive('bqAuctionList', auctionList);
function auctionList() {
return {
scope: {
auctions: "=bqAuctionList"
},
templateUrl: 'components/templates/auction-list.html',
//controllerAs: 'vm',
//bindToController: true
controller: function ($scope, $state, $stateParams, $document) {
$scope.pagination = {
currentPage: parseInt($stateParams.page),
itemsPerPage: 25,
maxSize: 7
};
$scope.pageChanged = function (pageNumber, scroll) {
if (scroll) $document.scrollTopAnimated(0, 2000);
$state.go(".", { page: pageNumber }, { notify: false });
};
$scope.sortOptions = [{unimportant objects for sorting}];
$scope.selectedSort = $scope.sortOptions[2];
}
}
};
})();
奇怪的是,两个分页控件仍然有效,它只是在单击分页控件时抛出错误。
package.json的相关依赖项:
"angular": "~1.6.1",
"angular-ui-router": "^0.3.2",
"angular-utils-pagination": "^0.11.1"