简体   繁体   中英

Nested ngRepeat with complex JSON-Object

I need to show a table. Table consist with a list of objects (I don't know about length of this list), each object have a list of "data".

What have:

var list = [
    {
        name: "block1",
        data: [<bigArray1>]
    },
    {
        name: "block2",
        data: [<bigArray2>]
    },
    ....,
    {
        name: "blockN",
        data: [<bigArrayN>]
    }
]

.DATA-Array have always same length in all list.elements!

Is it possible to show this table?

TABLE

|--INDEX-----|--BLOCK1------|---BLOCK2-----|- *** -|----BLOCKN-----|
| 0          | bigarray1[0] | bigarary2[0] |- *** -| bigararyN[0]  | 
| 1          | bigarray1[1] | bigarray2[1] |- *** -| bigarrayN[1]  | 
| 2          | bigarray1[2] | bigarray2[2] |- *** -| bigarrayN[2]  | 
| 3          | bigarray1[3] | bigarray2[3] |- *** -| bigarrayN[3]  | 
|------------|--------------|--------------|-------|---------------|

Update 1:

data-Array have length between 10.000 - 100.000 or more. And this data I use in mobile App. Solutions with converting and create a new array is from performance , i think, very bad idea... or?


Update 2:

TABLE COLUMN HEADER length = 1 (for "Nr") + list.length
TABLE BODY length = list[].data.length


Update 3:

Demo

<table>
  <thead>
    <th>Index</th>
    <th ng-repeat="column in list">{{column.name}}</th>
  </thead>
  <tbody>
    <tr ng-repeat="index in list[0].data track by $index">
      <td>
        {{$index}}
      </td>
      <td ng-repeat="column in list">
        {{column.data[$parent.$index]}}
      </td>
    </tr>
  </tbody>
</table>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM