I want to alternatively repeat the json data. I've data like below:
JSON:
{
"birds":{
"birdInfo":[
{
"name":"parrot",
"color":"green"
},
{
"name":"peacock",
"color":"green"
}
]
},
"animals":{
"animalInfo":[
{
"name":"lion",
"designation":"king"
},
{
"name":"lioness",
"designation":"queen"
}
]
}
}
In my controller:
$scope.birdInfo = response.birds.birdInfo;
$scope.animalInfo = response.animals.animalInfo;
In my View:
<div ng-repeat="bird in birdInfo">
{{bird.name}}
</div>
<div ng-repeat="animal in animalInfo">
{{animal.name}}
</div>
What I want:
I want data to be display like:
Scenario 1 : one alternative repeat item
parrot
LION
peacock
LIONESS
Scenario 1 : two alternative repeat items
parrot
peacock
LION
LIONESS
crow
dove
TIGER
ELEPHANT
How to do that in angular?
Here is the plnkr: http://plnkr.co/edit/hN7odUF3MLJe4Ad9IBNM?p=preview