I'm having trouble alphabetizing a list using a JSON array in my code. Despite my efforts, the sorting doesn't seem to be working correctly. You can view my current code by following this link to the jsfiddle http://jsfiddle.net/hxxLaxL3/
Here is an overview of HTML part:
<div ng-app>
<div ng-controller="Ctrl">
<li ng-repeat="f in friends | orderBy:'f'">{{f}}</li>
</div>
</div>
In Angular part:
function Ctrl($scope) {
$scope.friends =
['C',
'B',
'Z',
'S'];
}
Current Output:
- C
- B
- Z
- S
Expected Output:
- B
- C
- S
- Z