I am trying to group by a set of items inside an array in reverse order. I cant figure out what I need. Any help will be appreciate it. I have tried orderby with the minus with no luck.
This is my code
It groups by Year and Month ascending order 2016, 2015. What I want is to display them in descending order 2014, 2015, 2016
$scope.Reports =
[
{ Id: 1, Name: 'Report One', Year: 2016, Month: 5 },
{ Id: 2, Name: 'Report Core', Year: 2016, Month: 5 },
{ Id: 3, Name: 'Report Alpha', Year: 2016, Month: 3 },
{ Id: 4, Name: 'Report Moon', Year: 2015, Month: 5 },
{ Id: 5, Name: 'Report Sky', Year: 2015, Month: 2 }
];
<body>
<div ng-controller="MainController">
<ul ng-repeat="(key, value) in Reports | groupBy: 'Year'">
{{ key }}
<ul ng-repeat="(key1, value1) in value | groupBy: 'Month'">
O{{key1}}
<li ng-repeat="p in value1">
{{p.Name }}
</li>
</ul>
</ul>
</div>
</body>