nour nour nour nour - 4 months ago 6x
AngularJS Question

How to get the json files data in an alphabetic order

I parsed three different json files using AngularJS. Here's my code:

Factory code

app.factory('myapp', ['$http', function($http) {
function getLists() {
var tab = ['url1', 'url2', 'url3'];
var list = [];
for(i = 0; i < tab.length; i++) {
.then(function(res) {
return list;

return {
getLists: getLists

What I want is to display the data of the different files in a , the data of the first url in the first line , the second one in the second line , etc...
I have to display the data depending on the alphabetic order of the names 'nm'.

Html code:

<tr ng-repeat="d in list">

What should I do?


you can simply use orderBy

like so

<tr ng-repeat="d in list | orderBy: 'nm'">