Ng-repeat an array of upto 20 objects

So I have flow that produces an output on the payload of an array that contains anywhere from 0-20 objects, where each object looks like the following:

{
   "tx_id":"0x5e7d692de72b3b66b013090618eb4a3c2712ad1592253ce42531f61ae9df7aa3",
   "tx_type":"token_transfer",
   "nonce":795,
   "fee_rate":"180",
   "sender_address":"SP33XEHK2SXXH625VG6W6665WBBPX1ENQVKNEYCYY",
   "sponsored":false,
   "post_condition_mode":"deny",
   "tx_status":"success",
   "block_hash":"0xcf74c686e04f139b1fa1d7bbb612846070d89393024d086cfc5e9b19e8df31f8",
   "block_height":12491,
   "burn_block_time":1619423774,
   "burn_block_time_iso":"2021-04-26T07:56:14.000Z",
   "canonical":true,
   "tx_index":1,
   "tx_result":{
      "hex":"0x0703",
      "repr":"(ok true)"
   },
   "token_transfer":{
      "recipient_address":"SP1P72Z3704VMT3DMHPP2CB8TGQWGDBHD3RPR9GZS",
      "amount":"248328688",
      "memo":"0x31303537303932333500000000000000000000000000000000000000000000000000"
   },
   "events":[
      
   ],
   "event_count":1
}

I'm trying to present these properties of each object(s) in the array in a template node, I figured I would just start out by trying to sequentially present the tx_id property.

<table>
    <tr ng-repeat="obj in msg.payload track by $index">
        <td>{{msg.payload[0].tx_id}}</td>
    </tr>
</table>

But this just repeats the literal string from the first object 20 times, instead of walking through each object and present the relative .tx_id.

Any help would be appreciated, this part always trips me up lol

Try

<table>
    <tr ng-repeat="obj in msg.payload">
        <td>{{obj.tx_id}}</td>
    </tr>
</table>

1 Like

Thanks buddy, I knew i was overthinking this lul!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.