0

I'm getting some JSON returned from a server for which I'd like to iterate over the key value pair label and value. I tried to access the values by using the following but I get nothing.

What am I missing for this to work?

HTML :

<tr ng-repeat="(label, value) in data[0].[label]">
    <td>{{label}}</td>
    <td>{{value}}</td>
</tr>

JSON input :

"data": {
    "title": {
        "label": "Title",
        "value": "Mr"
    },
}
1
  • is that a typo...? data is not an array here...and i guess there is an extra period after data[0] Commented Jul 10, 2014 at 8:21

1 Answer 1

2
<tr ng-repeat="title in data">
    <td>{{title.label}}</td>
    <td>{{title.value}}</td>
</tr>

(Assuming your Json is in a variable like $scope.data)

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

1 Comment

I can't believe I missed that! Thank you!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.