my nested json is killing me, seem I have to write a custom filter to do orderBy
$scope.ranking = [
{
'uId': 2,
'name': 'Jeremy',
'tabs': [{
'tabId': 1,
'points': 100,
}, {
'tabId': 2,
'points': 10
}],
},
{
'uId': 3,
'name': 'Jordon',
'tabs': [{
'tabId': 1,
'points': 180,
},{
'tabId': 2,
'points': 5
}],
}]
}
what I want is sort users' ranking by points. It would be easy if the tabs contain single points, but multiple tabs indicate the types of game they played.
look at my fiddle then you'll know what I'm try to do, here http://jsfiddle.net/U4dd8/
I wrote my custom filter until here
app.filter("rankFilter", function(){
return function (input, points) {
var output = [];
for (var i in input) {
for(var j in input[i].tabs){
var points = input[i].tabs[j].points;
output.push(points);
}
}
return output;
};