I'm pretty new to angular and I'm stuck with something. I'm pulling data from an API with a service I named RateInfoService. The JSON looks like this

$scope.refreshData = function() {
RateInfoService.getMarket($scope.alarmingMarket).success(function(data) {
if($scope.alarmingMarket.length <= 1){
$scope.rate = [];
$scope.rate.marketid = data.query.results.rate.id;
$scope.rate.rate = data.query.results.rate.Rate;
$scope.rate.updateTime = data.query.results.rate.Time;
console.log($scope.rate);
} else {
angular.forEach(data.query.results.rate, function (value, key){
$scope.rate = [];
$scope.rate.marketid = data.query.results.rate[key].id;
$scope.rate.rate = data.query.results.rate[key].Rate;
$scope.rate.updateTime = data.query.results.rate[key].Time;
console.log($scope.rate);
});
}
})
}
and checking array length is only because I pull another URL as API. I try to show it in the view but it fails, because the user can fill in chips.. but after it also cola. The view only shows cola because it overwrites the chips because of the loop. I tried in both different ways
<tr ng-repeat="rate in rates track by $index">
<p>{{rate.marketid}} {{rate.rate}}</p>
<p>Last price update {{rate.updateTime}} </p>
</tr>
and
<tr ng-repeat="data.query.results.rate.id track by $index">
<p>{{$index + 1}}</p>
<p>{{rate.marketid}} {{rate.rate}}</p>
<p>Last price update {{rate.updateTime}} </p>
</tr>
Both only show cola. It is probably because of scope.rate = [] but I struggle with my code and how to fix it. with PHP I often used someting like foreach($prices as $index=>pricing){code}
But how can I do it with angular, or does anyone has a fix or example code.