I have the following response from a service in my AngularJS app:
{
"people": [
{"id": "b3b38689", "name": "Tom"},
{"id": "a62e603f", "name": "Dick"},
{"id": "da703c62", "name": "Harry"}
],
"groups": [
{"name": "group 1", participants: ["b3b38689", "a62e603f"]},
{"name": "group 2", participants: ["a62e603f", "da703c62"]}
]
}
Ultimately this gets mapped to
$scope.data
Then, in my view I have:
<div data-ng-repeat="group in data.groups">
<h1>{{group.name}}</h1>
<p data-ng-repeat="participant in group.participants">...</p>
</div>
This is successfully outputting:
<div>
<h1>group 1</h1>
<p>...</p>
<p>...</p>
</div>
<div>
<h1>group 2</h1>
<p>...</p>
<p>...</p>
</div>
I'd like to put into the 'p' tags "people[n].name" of the entry that the id matches up.
Is anyone able to help me understand how I would accomplish this please?
Regards,
Chris