Here is some information I have:
$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 }
];
$scope.desc = function (arr) {
return $('min')
($('map')(arr, '-Year'));
};
I am attempting to extract the list of Year
values in descending order, which will be used with an orderBy
filter in AngularJs.
Given the above data, I wish to obtain [2016, 2015]
.
Can anyone guide me on how to achieve this?