我有一个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>
Run Code Online (Sandbox Code Playgroud)