angularjsfilterdirpagination

Dir-paginate GET row count after filter - angularJs


I would like to have the number of lines after filter on my list. With dir-paginate , the result is always 5 (== itemsPerPage) or i have > 5 lines. Does anyone know how I can get this row count for all page in my dir-paginate?

<div>count filtered :  ({{ filtered.length }})</div>
<input type="text" class=" text-input form-control" ng-model="search.name"  placeholder="name">
<div class="col-md-6">
        <table class="table">
            <thead>
                <tr>
                    <th></th>
                    <th>Title</th>
                </tr>
            </thead>
            <tbody>
                <tr dir-paginate="person in persons | filter:_this.search  | itemsPerPage:5  as filtered" pagination-id="excluded">
                    <td>{{ person.name }}</td>
                </tr>
            </tbody>
        </table>
</div>
<dir-pagination-controls max-size="5"
         direction-links="true"
         boundary-links="true" class="pagination">
</dir-pagination-controls>

thanks


Solution

  • You have to do this manually row count

    change

     <tr dir-paginate="person in persons | filter:_this.search  | itemsPerPage:5  as filtered" pagination-id="excluded">
    

    to

    <tr dir-paginate="person in filtered = (persons | filter:_this.search)  | itemsPerPage:5 " pagination-id="excluded">
    

    and you can get count by filtered.length

    Ref