简体   繁体   English

分页在模板中不起作用

[英]pagination doesn't work in template

When i click on page number it doesn't display the corresponding results. 当我单击页码时,它不会显示相应的结果。 Here is a sample of code. 这是代码示例。

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

Corresponding controller is where am populating data from services, service is giving right data: 相应的控制器是从服务中填充数据的地方,服务在提供正确的数据:

 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();
 });

} }

I fixed it using id concept. 我使用id概念修复了它。 Below is my code how i fixed this issue. 以下是我的代码如何解决此问题。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM