How to orderBy a array of objects in descending order in angularjs?

Adding + or - prefix on orderBy parameter will order by + (ascending) or -(desc);

example:

<li ng-repeat="x in customers | orderBy : '-city'">
    {{x.name + ", " + x.city}}
</li>

more at : http://www.w3schools.com/angular/ng_filter_orderby.asp

Or if you want to console.log it then just add name as parameter in quotations :

$filter('orderBy')(person, 'name');

You should pass 2nd parameter as property name name, then assign that filtered result to desire scope variable wherever you want. So there will not be any filtering needs to be done on UI ng-repeat output.

$scope.person = $filter('orderBy')(person, 'name');

<div  ng-repeat="p in person">
   {{p.name}}
</div>

Forked Fiddle Here


If you wanted to see it on view you should keep that property on one of scope variable, or rather you can do this simple filtering on client side as well while displaying records.

<div  ng-repeat="p in person | orderBy: 'name'">
   {{p.name}}
</div>

Demo here