The problem is that you're calling the reverse function in ng-repeat and that $apply and $digest many times. If you're using AngularJS 1.3.x and your data will be created once and will not change at run-time, you can use bind-once property by typing the following in any of ng-(directives)
<body ng-init='a = [1, 2, 3].reverse()'>
<div ng-repeat="item in ::a">{{item}}</div>
</body>
prefixing a with :: tells AngularJS that this array or this variable won't be changed, so it will release the $watch function from it and won't consume $digest too many times.
For more information about bind once feature, check this one-time-binding
For the reversing technique itself if it's dynamically created and frequently changed, you can use one of the following approaches:
<body ng-init='a = [1, 2, 3]'>
<div ng-repeat="item in a.slice().reverse()">{{item}}</div>
</body>
or also you can wrap this into filter, you can use it as follows:
app.filter('reverse', function() {
return function(items) {
return items.slice().reverse();
};
});
and in the HTML type the following line of code:
<body ng-init='a = [1, 2, 3]'>
<div ng-repeat="item in a | reverse">{{item}}</div>
</body>
for ordering array of objects in general, you should use the following:
<body ng-init='a = [{id: 1}, {id: 2}, {id: 3}]'>
<div ng-repeat="item in a | orderBy:'id':true">{{item.id}}</div>
</body>
using true for reverse ordering and false for ascending ordering.
You can check also this question and answer for more information:
angular ng-repeat in reverse