Say I have the following JSON file
{
"A": [
{"name": "foo",
"BRef": "123"
},
{"name": "Hello",
"BRef": "456"
}
],
"B": [
{"ID": "123",
"lastName": "bar"
},
{
"ID": "456",
"lastName": "World"
}
]
}
I have linked the model and view via the controller
$http.get('js/data.json')
.success(function(data) {
$scope.A = data.A;
$scope.B = data.B;
How do I loop through A and dig out the lastname from B?
<div ng-repeat="a in A">
<h1>{{a.name}} {{ <<(B.b.ID == a.BRef).lastname>> }}</h1>
</div>
Was thinking that an ng-repeat of B with an filter might do the trick.. but I'm not that skilled with angular filter (yet)