angularjs - angular loop through nested json array -


i have following json structure

     "bonds": [ {   "name": "bond_0",   "interface": [     "nic_0",     "nic_1"   ],   "mode": "active_standby",   "primary_interface": "nic_0" }, {   "name": "bond_1",   "interface": [     "nic_0",     "nic_1"   ],   "mode": "active_standby",   "primary_interface": "nic_0" } 

]

i need loop , display data in table. although can display values ihave trouble display interface array. tried ng-repeat="interface in bond.interfaces not working. appreciated @ view code

<table class="table">             <tr>               <th>name</th>               <th>interface</th>               <th>mode</th>               <th>primary interface</th>             </tr>             <tr ng-repeat="bond in bonds">               <td><div>{{bond.name}}</div></td>               <td><table><tr ng-repeat="interface in bond.interfaces"><td>{{interface}}</td></tr></table></td>               <td>{{bond.mode}}</td>               <td>{{bond.primary_interface}}</td>             </tr>           </table> 

please update code from

<tr ng-repeat="interface in bond.interfaces"> 

to

<tr ng-repeat="interface in bond.interface"> 

bond has interface property. bond.interface work.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -