以角度js显示1到10个x记录

时间:2017-02-14 11:29:50

标签: angularjs dirpagination

我想显示两次显示1到10个x记录在一个页面中有两个不同的DIV,如下所示,例如:我有一个页面有两个div元素,如下所示。

如何使用dirpagination来实现?

1页:

 <div> 
 Displaying 1 to 2 of 2
    Name  Age 
    xxx    17 
    yyy    18  
 </div>

<div> 
 Displaying 1 to 2 of 2
    Name  Age 
    abc    22 
    pqr    25 
    mmm    20
</div>

dirPagination.js文件如下所示

function updateRangeValues() {
                debugger;
                if (paginationService.isRegistered(paginationId)) {
                    var currentPage = paginationService.getCurrentPage(paginationId),
                        itemsPerPage = paginationService.getItemsPerPage(paginationId),
                        totalItems = paginationService.getCollectionLength(paginationId);
                    var objPg = paginationService.registerInstance(paginationId);
                    scope.range.lower = (currentPage - 1) * itemsPerPage + 1;
                    scope.range.upper = Math.min(currentPage * itemsPerPage, totalItems);
                    scope.range.total = totalItems;
                    scope.$parent.range = scope.range;
                }
            }

.cshtml页面是

Displaying {{ range.lower }} to {{ range.upper }} of {{ range.total }} records



<tr dir-paginate="rec in Recds | itemsPerPage : 10 class="feed-element"> 
3 <td>'s like above
<dir-pagination-controls pagination-id="pg1" max-size="10" direction-links="true" boundary-links="false"> </dir-pagination-controls>
</tr>

<tr dir-paginate="rec in Recds | itemsPerPage : 10 class="feed-element"> 
    3 <td>'s like above
    <dir-pagination-controls pagination-id="pg2" max-size="10" direction-links="true" boundary-links="false"> </dir-pagination-controls>
    </tr>

0 个答案:

没有答案