Imagine I have an array containing keys in a specific order
orderedItems=["apple","banana","orange];
and there is a JSON object that I want to display using ng-repeat but following the sequence specified in the array:
{"fruits":
{
"apple":{
"color":"red",
"taste":"sweet"
},
"banana":{
"color":"yellow",
"taste":"creamy"
},
"orange":{
"color":"orange",
"taste":"citrusy"
}
}
}
How can I create a filter so that ng-repeat lists the fruits in the exact order as they are mentioned in the array?
<li ng-repeat="item in fruits | customOrder"></li>