I know that in angularJS there is some built in filter: for example
But I don\'t want to us
Use Array.sort. Refer to the example below
var app = angular.module('so', []);
app.controller('MyCtrl', function($scope) {
$scope.students = [{'name': 'student'}, {'name': 'john'}, {'name': 'austin'}, {'name': 'doe'}];
});
app.filter('filterByName', function () {
return function (item) {
return item.sort((a,b) => a.name.localeCompare(b.name))
};
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.3/angular.min.js"></script>
<div ng-app="so">
<div ng-controller="MyCtrl">
<li ng-repeat="student in students | filterByName track by $index">{{student.name}}</li>
</div>
</div>