首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当ng模型搜索放置某物时,dirPagination数字不变。

当ng模型搜索放置某物时,dirPagination数字不变。
EN

Stack Overflow用户
提问于 2016-08-14 10:21:07
回答 1查看 551关注 0票数 1

首先,我正在使用dirPagination。问题是,当我搜索某物时,它被正确过滤,但是分页号没有改变,并且显示了分页中的所有最后数,没有任何改变。我看到一些页面是空的,因为它是过滤的,但是显示的是页码。

代码语言:javascript
复制
<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>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-08-14 15:52:43

itemsPerPage必须是最后一个 filter,如下所示:

代码语言:javascript
复制
<tr dir-paginate='product in products | filter: search | orderBy: sortKey: reverse | itemsPerPage: 12'>

有关更多的解释,请在FAQ on michaelbromley/angularUtils/上查看。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38941262

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档