即使 angular 中没有数据,也会显示分页

Pagination shown even though there is no data in angular

这是我的代码:

按钮:

<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>

单击按钮时填充的数据:

<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>

控制器内部:

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

我正在使用此 link:

中的分页指令

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

分页有问题,您再次加载数据后它不会更新集合。

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

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

显然是一种解决方法

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