0

I have an array similar to this [{"FirstValue":{"SubValue1":"ReallyLongValue"}, "SecondValue": "Michigan" }, {"FirstValue":{"SubValue2":"John"}, "SecondValue": "Vegas" }]

I need to be able to create a table like the following SubValue1: ReallyLongValue Michigan SubValue2: John Vegas

I have an ng-repeat going over the outer array which creates a directive. Inside of that directive I do another ng-repeat as follows

<td ng-repeat="(type, name) in employeecell.FirstValue">
  {{type}}
  <td>{{type}}</td>
  <td>{{name}}</td>
  <td>{{employeecell.SecondValue}}</td>
  <td>
    <button>test</button>
  </td>
</td>

This will bind the first type but once it reaches the next {{type}} it is just blank. I have tried using a div instead for the ng-repeat which does not work. I need to be able to get the actual value of the key "SubValue" as that is not potentially known.

Maybe I am approaching this incorrectly. I created a plnkr to give an idea of what I am going for.

http://plnkr.co/edit/mPtYGj?p=preview

1 Answer 1

1

It looks like this is actually an HTML issue. Try this with the inner html table.

<td ng-repeat="(type, name) in employeecell.FirstValue">
{{type}}
  <table>
    <tr>
      <td>{{type}}</td>
      <td>{{name}}</td>
      <td>{{employeecell.SecondValue}}</td>
      <td><button>remove</button></td>
    </tr>
</table>
</td>

Is that what you were looking for?

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.