0f3db709ea
Fixes #637 Note: This PR does *not* actually raise the event; it merely adds support for it
17 lines
442 B
JavaScript
17 lines
442 B
JavaScript
// From: http://justinklemm.com/angularjs-filter-ordering-objects-ngrepeat/ under MIT License
|
|
quayApp.filter('orderObjectBy', function() {
|
|
return function(items, field, reverse) {
|
|
var filtered = [];
|
|
angular.forEach(items, function(item) {
|
|
filtered.push(item);
|
|
});
|
|
|
|
filtered.sort(function (a, b) {
|
|
return (a[field] > b[field] ? 1 : -1);
|
|
});
|
|
|
|
if(reverse) filtered.reverse();
|
|
|
|
return filtered;
|
|
};
|
|
});
|