I have an array of arrays of objects with the following structure:
parentArray = [
[{id:1, date:1505020200000}, {id:4, date:1505020200000 }],
[{id:2, date:1504681500000}],
[{id:3, date:1504671000000}, {id:20, date:1504671000000}]
]
Each nested array contains dates that are all the same.
I am attempting to utilize Angular's orderBy filter to sort the dates from oldest to newest, but I am uncertain about the process.
I attempted setting the dateFilter variable for orderBy filter like this:
$scope.dateFilter= arr[0][0].date
<div ng-repeat="child in parentArray | orderBy: dateFilter">
however, it seems that something is not right.
EDIT:
Many thanks to Matthew for his assistance and guidance. With his help, I realized the solution. Utilizing array.sort was what worked best for my data structure.
$scope.results.sort(function (a, b) {
return a[0].date - b[0].date;
});