即使没有角度数据,也会显示分页

时间:2016-06-10 14:11:59

标签: javascript angularjs dirpagination

这是我的代码:

按钮:

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

我正在使用此链接中的分页指令:

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

1 个答案:

答案 0 :(得分:1)

dirpagination的一个问题是它在你再次加载数据后没有更新集合。

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>