分页没有'不能在模板中工作

pagination doesn't work in template

本文关键字:工作 不能 分页      更新时间:2023-09-26

当我点击页码时,它不会显示相应的结果。这是一个代码示例。

<div class="col wrapper-sm w-md bg-auto dk r-r">
<div class="panel panel-default" ng-show="$parent.showPie === true;">
    <div class="table-responsive">
        <table class="table" ng-show="hashes[0]" id="placement">
            <thead>
                <th> Hash </th>
                <th> MalwareFamily </th>
                <th> Score </th>
                <th> Counts </th>
            </thead>
            <tbody>
                <tr dir-paginate="hash in hashes| itemsPerPage:20">
                    <td><a href="#/app/country/{{countryName}}/cCode/{{stateCode}}/hash/{{hash['hash']}}/inbox/info" >{{hash['hash']}} </a></td>
                    <td> {{hash['malFamily']}} </td>
                    <td> {{hash['malScore']}} </td>
                    <td> {{hash['hits']}} </td>
                </tr>
            </tbody>
        </table>
    </div>
    <div id="content">
        <dir-pagination-controls></dir-pagination-controls>
    </div>
</div>

相应的控制器是从服务中填充数据的地方,服务提供正确的数据:

 function malPAge(test) {
 crudSrv.getResults(rootURL.url.baseURL + "global/country/" + $scope.stateCode + "/attacks/malware/hashes/" + test + "/", function(data, status) {
     ngProgress.complete();
     $scope.hashes = data;
     var m = "placement";
     $location.hash(m);
     $anchorScroll();
 });

}

我使用id概念修复了它。以下是我如何修复此问题的代码。

<div class="col wrapper-sm w-md bg-auto dk r-r">
<div class="panel panel-default" ng-show="$parent.showPie === true;">
    <div class="table-responsive">
        <table class="table" ng-show="hashes[0]" id="placement">
            <thead>
                <th> Hash </th>
                <th> MalwareFamily </th>
                <th> Score </th>
                <th> Counts </th>
            </thead>
            <tbody>
                <tr dir-paginate="hash in hashes| itemsPerPage:20" pagination-id="hash">
                    <td><a href="#/app/country/{{countryName}}/cCode/{{stateCode}}/hash/{{hash['hash']}}/inbox/info" >{{hash['hash']}} </a></td>
                    <td> {{hash['malFamily']}} </td>
                    <td> {{hash['malScore']}} </td>
                    <td> {{hash['hits']}} </td>
                </tr>
            </tbody>
        </table>
    </div>
    <div id="content">
        <dir-pagination-controls pagination-id="hash"></dir-pagination-controls>
    </div>
</div>