I'm having two JSON Array, $scope.data has the primary details, which I want to show in the UI, in that cInstId
is the foreign key
from the JSON $scope.color.
The two JSON Arrays are
$scope.data = [
{
"id": 1,
"cTitle": "One",
"cInstId": 1
},
{
"id": 2,
"cTitle": "Two",
"cInstId": 2
},
{
"id": 3,
"cTitle": "Three",
"cInstId": 3
},
{
"id": 4,
"cTitle": "Four",
"cInstId": 4
},
{
"id": 5,
"cTitle": "Five",
"cInstId": 4
}
];
$scope.color = [
{
"cInstId": 1,
"cInstTitle": "Blue"
},
{
"cInstId": 2,
"cInstTitle": "Green"
},
{
"cInstId": 3,
"cInstTitle": "Red"
},
{
"cInstId": 4,
"cInstTitle": "Orange"
},
{
"cInstId": 5,
"cInstTitle": "Violet"
}
];
My expected output should be as like the picture
<div ng-repeat="members in data">
<!-- How to Show it in the UI -->
</div>
Note: Don't create any temp array and for-each implementation in the Controller.