1

I have the 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 to loop and display the data in a table. although I can display all the values ihave trouble to display the interface array. I tried to do this with ng-repeat="interface in bond.interfaces but it is not working. your help will be appreciated at my view the code is

<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>
1
  • Typo? interface v/s interfaces. Also is the object bonds assigned directly to the scope? Commented Jun 14, 2015 at 16:32

1 Answer 1

1

Please update your code from

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

to

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

bond has interface as a property. So bond.interface will work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.