AngularJS ngRepeat and orderBy.
by Sajeetharan Sinnathurai
HTML
<div ng-app="myApp" ng-controller="ListCtrl">
<div ng-repeat="employe in employee.staff | orderBy:$index:true">
<div>{{employe}}</div>
</div>
</div>
JavaScript
angular.module('myApp', [])
.controller('ListCtrl', function($scope) {
$scope.updatelist = [];
$scope.employee = {
"staff" :
[
{
"id" : 1,
"Name" : "John",
"email" : "[email protected]"
},
{
"id" : 2,
"Name" : "Watson",
"email" : "[email protected]"
},
{
"id" : 3,
"Name" : "jack",
"email" : "[email protected]"
},
{
"id" : 4,
"Name" : "Jim",
"email" : "[email protected]"
},
{
"id" : 5,
"Name" : "Rose",
"email" : "[email protected]"
}
]
};
}
});