I'm trying to alphabetize a list based on a json array, but I cant seem to get it to work. My current code looks like this. Here is a link to the jsfiddle http://jsfiddle.net/hxxLaxL3/
HTML
<div ng-app>
<div ng-controller="Ctrl">
<li ng-repeat="f in friends | orderBy:'f'">{{f}}</li>
</div>
</div>
Angular
function Ctrl($scope) {
$scope.friends =
['C',
'B',
'Z',
'S'];
}
Output
- C
- B
- Z
- S
Desired Output
- B
- C
- S
- Z