What I'm trying to make is a comparator for statusus, I made an array of names for the names of the channels that I want to compare:
var stations = [
"BasicChannel",
"PixelChannel",
"GoldenChannel"
];
Now, through using a foreach loop I want to do a HTTP call with all of those statusus:
angular.forEach(stations, function(channel) {
$http({
method: "GET",
url: channel + ".php"
}).success(function(data) {
data.name = channel;
$scope.channels = data;
});
});
Now, the problem is that I have is that every time I do a HTTP call, it overrides the other ones.
Is there a way to get these in an object, or an array maybe?
Thanks.
$scope.channelsis what you're overriding. Why not do$scope.channels[channel] = data?