【发布时间】:2017-05-04 13:15:48
【问题描述】:
我有一个Angular2 应用程序和一个component,我有一张桌子。
表是通过*ngFor 指令生成的。
table 的每一行都是一个包含 9 个字段的对象,该对象在组件初始化时从后端加载。
在应用程序中,我尝试将 ng-bootstrap 用于角度模块。
ng-boorstrap
特别是我正在尝试实现pagination 组件。
有人可以解释一下如何放置代码以便它可以呈现例如请每页只有 10 行? 或者给我一个参考,实现的地方。
我所做的是:
- 将
NgbModule引用放在我声明我的组件的模块以及NgbPaginationConfig模块(使用自定义分页所必需的) -
像这样将
ngb-pagination代码放在我的component的视图中<table class="table table-striped"> <thead> <tr> <th>Tracking #</th> <th>Brand</th> <th>Geography</th> <th>Country</th> <th>Contract Name</th> <th>Project Name</th> <th>Status</th> <th>$US BMC</th> <th>Release #</th> <th id="column-last"></th> </tr> </thead> <tbody> <tr *ngFor="let item of viewRows "> <td>{{item.trackingNr}}</td> <td>{{item.brand}}</td> <td>{{item.geo}}</td> <td>{{item.country}}</td> <td>{{item.contractName}}</td> <td>{{item.projectName}}</td> <td>{{item.status}}</td> <td>{{item.usBmc}}</td> <td>{{item.releaseNr}}</td> <td id="column-last"> <span class="awficon-edit" id="row-icons"></span> <span class="awficon-close-2" id="row-icons"></span> </td> </tr> </tbody>
【问题讨论】:
标签: angular ng-bootstrap