AngularJS ngRepeat and orderBy.
by Sajeetharan Sinnathurai
HTML
<div ng-app="myApp" ng-controller="Ctrl">
<div ng-repeat="card in myCards | orderBy:'firstName'">
<businesscard>{{card.firstName}} {{card.lastName}}</businesscard>
</div>
</div>
JavaScript
angular.module('myApp', [])
.controller('Ctrl', function($scope) {
$scope.myCards = [
{firstName: 'John', lastName: 'Smith'},
{firstName: 'Eleanor', lastName: 'Rigby'},
{firstName: 'Maxwell', lastName: 'Hammer'},
{firstName: 'Buzz', lastName: 'Aldrin'},
{firstName: 'Neil', lastName: 'Armstrong'}
];
});