如何使用 ng-table-dynamic 和 $http 进行分页?
表格的 HTML 规范为
<table class="table-bonds table table-bordered table-hover table-striped"
export-csv="csv"
separator=","
show-filter="true"
ng-table-dynamic="bondsTable.bondsDataParams with bondsTable.bondsDataCols">
<tr ng-repeat="row in $data">
<td class="hand"
ng-repeat="col in $columns">{{::row.node[col.field]}}</td>
</tr>
建表代码为:
self.bondsDataParams = new NgTableParams({
page: 1, // show first page
count: 5 // count per page
}, {
filterDelay: 0,
total: 0,
getData: function (params) {
return $http(bondsDataRemote).then(function successCallback(response) {
// http://codepen.io/christianacca/pen/mJoGPE for total setting example.
params.total(response.data.nodes.length);
return response.data.nodes;
}, function errorCallback(response) {
});
}
});
AngularJS 1.5.8
最佳答案
This是一个很好的分页指令,看看它。它有很多选项并且易于使用。
关于javascript - 如何对动态 AngularJS 表进行分页?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41291005/