Search Posts

Category: sorting

AngularJS Sorting for multiple ng-repeats

I am working on creating a schedule for which we have created a JSON like following { “cancelledWeeks”: { “1511548200”: [ { “match_id”: “e06d20944182aa2b5ead43e8990e5985”, “reason”: “chhj”, “round”: 1, “team1”: “team_id_17101711595974”, “team1_captains”: { }, “team1_color_code”: “#1f1818”, “team1_name”: “17October team”, “team2”: “team_id_1710179490074”, “team2_captains”: { }, “team2_color_code”: “#302929”, “team2_name”: “cms team 4”, “time”: “6:30 PM” }, { “match_id”: “4715cf8897663e5474feaa14ef396674”, “reason”: “chhj”, “round”: 1, “team1”: “team_id_17101712185745”, “team1_captains”: { }, “team1_color_code”: “#1f0606”, “team1_name”: “october 19”, “team2”: “team_id_1710179420033”, “team2_captains”: { }, […]

Angularjs: How to order an array based on a child array of object’s Date field

I’ve got an array of arrays of objects that has the following structure: parentArr = [ [{id:1, date:1505020200000}, {id:4, date:1505020200000 }], [{id:2, date:1504681500000}], [{id:3, date:1504671000000}, {id:20, date:1504671000000}] ] Each child array will only contain dates that are the same. What I’m trying to do is use angular’s orderBy filter to to order the dates from oldest to newest, but I’m unsure of how to do it. I’ve tried setting the orderby filter to a variable […]