在html Angular中显示[object Object]

时间:2018-01-30 13:23:52

标签: html arrays angular typescript html-table

我在表格中显示数据数组时遇到问题。

我有component.html

<div class="row">      
  <table class="bordered table-bordered" [mfData]="hbps| dataFilter : filterQuery" #mf="mfDataTable"   [mfRowsOnPage]="rowsOnPage" [(mfSortBy)]="sortBy" [(mfSortOrder)]="sortOrder">
    <thead>
      <tr>
        <th>
          <mfDefaultSorter by="serial_number">Serial Number</mfDefaultSorter>
        </th>
        <th>
          <mfDefaultSorter by="sensor_serial">Sensor Serial</mfDefaultSorter>
        </th>
       </tr>
    </thead>
    <tbody>
      <tr *ngFor="let item of mf.data">
        <td>{{item.serial_number}}</td>
        <ul><li>{{item.sensors[0].sensor_serial}}</li></ul>
        </tr>
    </tbody>
    <tfoot>
      <tr>
        <td colspan="5">
          <mfBootstrapPaginator [rowsOnPageSet]="[5,10,15]"></mfBootstrapPaginator>
        </td>
      </tr>
    </tfoot>   </table> </div>

component.ts

>       public hbps: HBPS[];
>     
>       ngOnInit() {
>         this.ws.hbpsGetAll().subscribe(
>           hbps=> {
>             this.hbps= hbps;
>           }
>         );
>       }

向我发送此数据

  • {“StatusCode”:0,“StatusMessage”:“OK”,“StatusDescription”:[{“homeboxpackage_id”:“1”,“active”:0,“homebox_id”:“11”,“ SERIAL_NUMBER “:” serialn1" , “USER_ID”: “31”, “sensors”:{“0”:{“sensor_serial”:“sensorserial1”, “sensors_id”: “11E805BA6732C3DB”}, “1”:{ “sensor_serial”: “sensorserial2”, “sensors_id”: “11E805BA6F1E6CE9”}, “2”:{ “sensor_serial”: “sensorserial3”, “sensors_id”: “11E805BA7716C775”}}}]

而且,我的物体传感器:string []

你能帮我在桌子的单元格中显示所有阵列传感器。

0 个答案:

没有答案