My application was built on Angular JS and has a lot AJAX requests on server. For example, in PHP I format output array like as:
$dialog[$us
orderBy
is a filter, and filters require an array. So a straightforward solution is to combine it with a toArray
filter. Supposing you want to order your objects using their time
property:
-
{{value.name_user}} said
{{value.message}}
on {{value.time|date}}
As the toArray
filter is not shipped with AngularJS, you can define one as:
angular.module('ToArrayDemo', [])
.filter('toArray', function() {
return function(obj) {
const result = [];
angular.forEach(obj, function(val) {
result.push(val);
});
return result;
}
});
See https://plnkr.co/edit/E857InfrEGqToW0SvwOh?p=preview