I have a controller with several calls $http.get('/...')
that get the data correctly.
$scope.results = [];
$http.get('/call1').then(function(response){
proccess(response);
});
$http.get('/call2').then(function(response){
proccess(response);
});
$http.get('/call2').then(function(response){
proccess(response);
});
The data that returns are of the type:
// call 1
{items:{1:{id: 1, title: "Título",…}, 2:{id: 2, title: "Título",…},…}}
// call 2
{items:{1:{id: 10, title: "Título",…}, 2:{id: 20, title: "Título",…},…}}
// call 3
{items:{1:{id: 100, title: "Título",…}, 2:{id: 200, title: "Título",…},…}}
In the function that it processes, being all the same structures is simple:
function proccess(response){
$scope.results = response.items;
}
ng-repeat
<div data-ng-repeat="item in results">
{{item.id}}
</div>
And this part is where I find the problem.
In theory I am trying to make the ng-repeat
update with the new data as you get it.
I've tried with extend
, concat
, merge
, push
... and I always replace them or I throw errors by console and I'm a bit stuck with this issue.
How should the answers be joined so that you update the ng-repeat
as you receive the data?
PD: Any questions comment and update