I have in my html page simple table with the possibility to sort rows by clicking on headers:
<table class="table-bordered table-striped table" style="width: 800px;">
<tr>
<th>
<a href="#" ng-click="sortType='id';sortReverse=!sortReverse">
ID
<span class="glyphicon glyphicon-triangle-bottom"
ng-show="sortType=='id' && !sortReverse"></span>
<span class="glyphicon glyphicon-triangle-top"
ng-show="sortType=='id' && sortReverse"></span>
</a>
</th>
<th>
<a href="#" ng-click="sortType='name';sortReverse=!sortReverse">
Name
<span class="glyphicon glyphicon-triangle-bottom"
ng-show="sortType=='name' && !sortReverse"></span>
<span class="glyphicon glyphicon-triangle-top"
ng-show="sortType=='name' && sortReverse"></span>
</a>
</th>
<th>
<a href="#" ng-click="sortType='desiredResolutionDate';sortReverse=!sortReverse">
Desired Date
<span class="glyphicon glyphicon-triangle-bottom"
ng-show="sortType=='desiredResolutionDate' && !sortReverse"></span>
<span class="glyphicon glyphicon-triangle-top"
ng-show="sortType=='desiredResolutionDate' && sortReverse"></span>
</a>
</th>
<th>
<a href="#" ng-click="sortType='urgency';sortReverse=!sortReverse">
Urgency
<span class="glyphicon glyphicon-triangle-bottom"
ng-show="sortType=='urgency' && !sortReverse"></span>
<span class="glyphicon glyphicon-triangle-top"
ng-show="sortType=='urgency' && sortReverse"></span>
</a>
</th>
<th>
<a href="#" ng-click="sortType='state';sortReverse=!sortReverse">
State
<span class="glyphicon glyphicon-triangle-bottom"
ng-show="sortType=='state' && !sortReverse"></span>
<span class="glyphicon glyphicon-triangle-top"
ng-show="sortType=='state' && sortReverse"></span>
</a>
</th>
<th>
Action
</th>
</tr>
<tr ng-repeat="ticket in allTickets | orderBy:sortType:sortReverse|filter:searchTicket">
<td>{{ticket.id}}</td>
<td><a href="#">{{ticket.name}}</a></td>
<td>{{ticket.desiredResolutionDate}}</td>
<td>{{ticket.urgency}}</td>
<td>{{ticket.state}}</td>
<td><input type="button" value="btn"></td>
</tr>
</table>
Controller part:
$scope.sortType = 'urgency';
$scope.sortReverse = false;
And it works, but if user click, for example, on "urgency" header, and I have 4 types of urgencies ('Critical','High','Medium','Low') it will sort rows in this order: 'Critical'->'High'->'Low'->'Medium', but I don't want to sort by characters, I want to sort by descending urgencies, like 'Critical'->'High'->'Medium'->'Low'.