Здравствуйте.
Хочу получить в массив данные из двух коллекций вида:
![ff7641048d634623843146eab642c430.png](https://habrastorage.org/files/ff7/641/048/ff7641048d634623843146eab642c430.png)
И вывести на странице в виде:
<div ng-repeat="post in vm.allPosts">
<h3>
{{ post.postCaption }}
</h3>
<p>
{{ post.postText }}
</p>
<span>Автор: {{ post.ownerName }}
<div ng-repeat="comment in post.comments">
<h4>
{{ comment.commentText }}
</h4>
<p>
{{ comment.ownerName }}
</p>
</div>
</div>
Пока придумалось вот так:
$q.all( [ getPosts(), getComments() ] ).then(
function (results) {
doSomethingOnThem(results[0], results[1]);
}
);
Может быть есть лучшие варианты, чтоб сразу получить объединенные данные в массиве?