0

I have a JSON

{"uuid":"5634","day":"three","one":{},"two":{},"three":{"people":[{"name":"sam","count":"2"},{"name":"das","count":"5"},{"name":"smith","count":"12"},]}}

I want to repeat only the data from the key "three". Is it possible to map that with the value "day"?

0

1 Answer 1

5

In your Controller, derive a new $scope variable for the data you wish to use in your view:

var data = {"uuid":"5634","day":"three","one":{},"two":{},"three":{"people":[{"name":"sam","count":"2"},{"name":"das","count":"5"},{"name":"smith","count":"12"},]}};
$scope.dayData = data[data.day];

Then use that variable in your view by amending the ng-repeat as follows:

<div ng-repeat="person in dayData.people">
  <h1>{{ person.name }}</h1>
  <p>Count : {{ person.count }}</p>
</div>

Example Plunk

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.