ng-init in ng-repeat zeigt nur die letzten Artikelinformationen an
Ich möchte folgende Elemente durchlaufen:
<section class="col-sm-4" data-ng-controller="PredictionsController" data-ng-init="findMyPredictions()">
<div class="games">
<div class="game-row" ng-repeat="prediction in predictions" ng-init="getGame(prediction.game_id)">
<a class="button primary alt block" href="#!/predictions/{{prediction._id}}">
<span class="home flag {{gameInfo.team1_key}}"></span>
<span class="middle">
<span class="date">{{gameInfo.play_at | date: 'd.MM HH:mm'}}</span>
<span class="versus">{{gameInfo.team1_title}} - {{gameInfo.team2_title}}</span>
</span>
<span class="away flag {{gameInfo.team2_key}}"></span>
</a>
</div>
</div>
</section>
Aber die Ausgabe ist nur das X-fache der gleichen Information: Obwohl die Anfrage korrekt ist:
Irgendeine Idee, was hier falsch ist?
UPDATE: Meine getGame Funktion:
$scope.getGame = function (game_id) {
$scope.gameInfo = {};
$http.get('/games/' + game_id)
.success(function (data) {
$scope.gameInfo = data;
});
};