关于angular获取数组中对象数组

1.在获取到数组data后,需要使用*ng-For循环数组中需要的对象的值

<nz-table #basicTable [nzData]="data">
 <tr *ngFor="let data of basicTable.data">
  <td>{{data.username}}td>
 <tr>
nz-table>

2.在data数组中,需要循环对象数组[{…}]里的对象

在TS中

if (d.succ) {
            this.matchRecord = d.list.matchRecord;
          } 

在HTML中

<tr *ngFor="let a of matchrecord.data">
            <td >
                {{a.matchDate}}
            td>
            <td>
              <span *ngFor="let d of a.bag">
                {{d.id}}<br>
              span>
            td>
<tr>

其中bag是对象数组,结构为blood: [{…},{…},{…}],matchRecord为返回值list中的对象数组,结构为matchRecord: [{…},{[{…}],[{…}],…}],其中bag为数组

你可能感兴趣的:(关于angular获取数组中对象数组)