javascriptangularjsdirpagination

Pagination shown even though there is no data in angular


Here is my code:

Buttons:

<li ><a data-ng-click="Data1 = true;Data2 = false; search.status = ''" href="">ALL PROJECTS</a></li>
<li ><a data-ng-click="Data2 = true;Data1 = false" href="">NOTIFICATIONS</a></li>

Populated data on click of button:

<ul>                                   
    <li ng-show="Data1" dir-paginate="wd in workOrdersList | filter: search.status | filter: search.name | itemsPerPage: 10">
        <a href="">
            <h4>{{wd.name}}</h4>
        </a>
        <p>Status: {{wd.status}}</p>
    </li>

    <li ng-show="Data2">
        <div ng-show="!notificationDataDashord.length">
                <span>No Notifications</span>
        </div>
    </li>
</ul>
<dir-pagination-controls auto-hide="true"></dir-pagination-controls>

Inside the controller:

$scope.Data1 = true; 
$scope.Data2 = false;

I am using pagination directive from this link:

https://github.com/michaelbromley/angularUtils/tree/master/src/directives/pagination


Solution

  • Its a problem with the dirpagination that it doesnt update the collections after you load the data again.

    See

    https://github.com/michaelbromley/angularUtils/issues/208

    https://github.com/michaelbromley/angularUtils/issues/137

    As a work around obviously

    <dir-pagination-controls ng-show="Data1" auto-hide="true"></dir-pagination-controls>