ฉันพยายามรวม dir-pagination-controls
แต่ไม่สามารถแสดงหน้าเว็บตามหน้าที่เลือกได้
<div ng-controller="TableController as tc">
<table>
<tbody dir-paginate="order in tc.orders | itemsPerPage: 10" total-items="tc.totalOrders" current-page="currentPage">
<tr ng-click="tc.showOrderDetail(order.id)">
<td ng-bind="order.id"></td>
<!-- Simliar lines are here -->
</tr>
</tbody>
</table>
<dir-pagination-controls
boundary-links="true"
on-page-change="tc.pageChangeHandler(newPageNumber)"
template-url="dirPagination.tpl.html">
</dir-pagination-controls>
</div>
table
นี้แสดงสิ่งที่ฉันคาดหวัง อย่างไรก็ตาม ตัวควบคุมการแบ่งหน้าผลลัพธ์จะไม่แสดงหน้าถัดไปเมื่อฉันกดปุ่มใดๆ
นี่คือส่วนที่เกี่ยวข้องของสคริปต์
angular.module('adminAngular', ['ui.bootstrap','dialogs.main','angularUtils.directives.dirPagination'])
.controller('TableController', function($http){
var instance = this;
this.orders = [];
$http({
//works fine
}).then(function (response) {
instance.orders = response.data;
instance.totalOrders = instance.orders.length;
//The "instance.orders" gets the expected data, and used for in dir-paginate="order in tc.orders
});
this.pageChangeHandler = function(num) {
console.log('going to page ' + num);
};
this.pageChanged = function(newPage) {
getResultsPage(newPage);
};
UPDATE pageChangeHandler
แสดงว่าปุ่มไหนถูกกด แต่หน้าไม่เปลี่ยนแปลง (อย่างอื่นก็ดีหมด)
รหัสนี้อิงตาม เอกสารอย่างเป็นทางการและการสาธิตแต่ ฉันไม่พบสิ่งที่ผิดจริง
ฉันขอขอบคุณหากคุณให้คำแนะนำใด ๆ