我从一个休息服务中得到一个大小为 9 的数组的响应,并且我将该响应分配给 angular2-datatable [mfData] 属性。单击按钮时,我正在打开一个模式,在其中显示此数据表,但分页是根据记录大小进行的,但数据不会出现或呈现在数据表中。在检查页面时,它显示模板绑定={ "ng-reflect-ng-for-of": null }
Component
this.requestFormService.getFlights(this.flightRequest).then(response => {
console.log(response);
this.flightList = response;
this.childModal.show();
}
html
<div class="modal-body">
<table class="table table-striped" [mfData]="flightList"
#mf="mfDataTable" [mfRowsOnPage]="5">
<thead>
<tr>
<th class="datatable-header"><mfDefaultSorter
by="flightCode">Flight No</mfDefaultSorter></th>
<th class="datatable-header"><mfDefaultSorter
by="departureStation">From</mfDefaultSorter></th>
<th class="datatable-header"><mfDefaultSorter
by="arrivalStation">To</mfDefaultSorter></th>
<th class="datatable-header"><mfDefaultSorter
by="scheduledDepartureTime">Departure Time</mfDefaultSorter></th>
<th class="datatable-header"><mfDefaultSorter
by="scheduledArrivalTime">Arrival Time</mfDefaultSorter></th>
<th class="datatable-header"><mfDefaultSorter
by="via">Via</mfDefaultSorter></th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of mf.data;let j = index"
(mouseover)="setMouseOveredRow(j)"
[class.active]="j == selectedRow"
(click)="setSelectedFlight(item)">
<td>{{item[0]}}</td>
<td>{{item[1]}}</td>
<td>{{item[2]}}</td>
<td>{{item[3]}}</td>
<td>{{item[4]}}</td>
<td>{{item[5]}}</td>
</tr>
</tbody>
<tfoot>
<tr>
`enter code here`<td colspan="6"><mfBootstrapPaginator
[rowsOnPageSet]="[5,10,25]"></mfBootstrapPaginator></td>
</tr>
</tfoot>
</table>
</div>