分页在模板中不起作用

时间:2016-07-18 09:46:22

标签: javascript angularjs

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

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

}

1 个答案:

答案 0 :(得分:0)

我使用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>