My client needs an angular js app, the app is based on an api, of an app that's already running. one of the apis, returns a json structured like this:
{
"groups":{
"60":{
"name":"History"
},
"74":{
"name":"Discover our offers"
},
"109":{
"name":"Relaxing"
}
}
}
so we fetched the data on a controller this way:
$http({method: 'GET', url: restUrl}).
then(function(response)
{
$scope.poi_groups = response.data.groups;
});
and display it on the view:
<ul class="content-menu">
<li ng-repeat="(key, value) in poi_groups">
<div><a ng-href="/poi/data/{{ key }}">{{ value.name }}</a></div>
</li>
</ul>
What I've been struggling with is ordering the items by name, right now its being displayed exactly the way its returned on the json. How can I do something like:
(...)
<li ng-repeat="(key, value) in poi_groups | orderBy: value.name">
(...)