首先,我正在使用dirPagination。问题是,当我搜索某物时,它被正确过滤,但是分页号没有改变,并且显示了分页中的所有最后数,没有任何改变。我看到一些页面是空的,因为它是过滤的,但是显示的是页码。
<div data-ng-controller='productsController'>
<form `class='form-inline'>
<div class='form-group'>
<label>search</label>
<input type='text' data-ng-model='search' class='form-control' placeholder='search' />
</div>
</form>
<table class='table table-striped'>
<thead>
<tr>
<th>#</th>
<th>product</th>
<th>imet</th>
</tr>
</thead>
<tbody>
<tr dir-paginate='product in products|itemsPerPage:12|filter:search|orderBy:sortKey:reverse'>
<td>{{product.id}}</td>
<td>{{product.productName}}</td>
<td>{{product.time}}</td>
</tr>
</tbody>
</table>
<dir-pagination-controls max-size='10' direction-links='true' boundary-links='true' >
</dir-pagination-controls>
<script>
(function(){
var app = angular.module('products', ['angularUtils.directives.dirPagination']);
app.controller('productsController', function($scope, $http){
$scope.products = [];
$http.get('/products/json').success(function(data){
$scope.products= data;
});
});
})();
</script>
</div>发布于 2016-08-14 15:52:43
itemsPerPage必须是最后一个 filter,如下所示:
<tr dir-paginate='product in products | filter: search | orderBy: sortKey: reverse | itemsPerPage: 12'>有关更多的解释,请在FAQ on michaelbromley/angularUtils/上查看。
https://stackoverflow.com/questions/38941262
复制相似问题