I have been trying to sort the below array by string and it is working fine. But the catch is that, the text "ALL", should always appear at the top of the list. Since it is sorted alphabetically, the text "ALL" is moved to its natural alphabetic position.The requirement is after sorting, its should be in the first element in list. how to do this the best way ?
<div ng-controller="MyCtrl">
<ul ng-repeat="strVal in arrVal|orderBy:'toString()'" >
<li>{{strVal}}</li>
</ul>
</div>
var app=angular.module('myApp', []);
app.controller('MyCtrl', function ($scope,$filter) {
$scope.arrVal = ['All','Alabama','Alaska','American Samoa','Arizona','Arkansas','California','Colorado','Connecticut','Delaware','District of Columbia','Federated States of Micronesia','Florida','Georgia','Guam','Hawaii','Idaho','Illinois','Indiana','Iowa','Kansas','Kentucky','Louisiana','Maine','Marshall Islands','Maryland','Massachusetts','Michigan','Minnesota','Mississippi','Missouri','Montana','Nebraska','Nevada','New Hampshire','New Jersey','New Mexico','New York','North Carolina','North Dakota','Northern Mariana Islands','Ohio','Oklahoma','Oregon','Palau','Pennsylvania','Puerto Rico','Rhode Island','South Carolina','South Dakota','Tennessee','Texas','Utah','Vermont','Virgin Island','Virginia','Washington','West Virginia','Wisconsin','Wyoming']
});