在单独的行中显示嵌套的JSON数据-Angular

时间:2018-07-20 08:46:11

标签: html arrays json angular

我想在单独的行中显示此数据,因为它们仅在第一行中全部显示。我想显示JSON数据中的“ FROM”

<ng-container matColumnDef="from">
    <mat-header-cell *matHeaderCellDef> From </mat-header-cell>
      <mat-cell *matCellDef="let element">
        <tr>{{element.computationrates[0].ratebands[0].from}}</tr>
        <tr>{{element.computationrates[0].ratebands[1].from}}</tr>
        <tr>{{element.computationrates[0].ratebands[2].from}}</tr>
        <tr>{{element.computationrates[0].ratebands[3].from}}</tr>
      </mat-cell>
  </ng-container>

有人可以告诉我如何编辑此代码以使它们显示在不同的行中

JSON数据

        [
     {
  "yearlyincentive": {
      "incentive": {
          "number": "0",
          "description": "null"
      },
      "year": "2016"
  },
  "computationrates": {
          "0": {
              "computation": "0",
              "ratetype": "0",
              "ratebands": [
                  {
                      "from": "0",
                      "to": "8,000",
                      "percent": "15%",
                      "subtract": "100" 
                  },
                  {
                      "from": "8,000",
                      "to": "15,000",
                      "percent": "20%",
                      "subtract": "250" 
                  },
                  {
                      "from": "15,000",
                      "to": "25,000",
                      "percent": "25%",
                      "subtract": "500" 
                  },
                  {
                      "from": "25,000",
                      "to": "50,000",
                      "percent": "35%",
                      "subtract": "1000" 
                  }
              ]
          }
  }
 }
 ]

0 个答案:

没有答案