There is such a code
$http.get('articles/articles.json').success(function(data){ $scope.articles = data; angular.forEach(data, function(article) { $scope.article = []; var url = 'articles/'+ article.year +'/' + article.mounth + '/articles' + article.titlemounth + '.json'; console.log(url); $http.get(url).success(function(data){ console.log(url); $scope.article.push(data); data = ''; }); }); }); Here is the output of the first log
articles/2016/april/articlesApril.json articles/2016/may/articlesMay.json articles/2016/jun/articlesJune.json But the second
articles/2016/april/articlesApril.json articles/2016/jun/articlesJune.json articles/2016/may/articlesMay.json Ie http does not work in the order in which it was intended. Please tell me what you can do about it.
$httpsends asynchronous requests, and the logs are displayed in the answers, it is impossible to guarantee in this case that the answers will come in the same order as there were requests - Grundy