我想遍历这样的项目:
<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>
但输出只是相同信息的 X 倍: 尽管请求正确完成:
知道这里有什么问题吗?
更新:我的 getGame 功能:
$scope.getGame = function (game_id) {
$scope.gameInfo = {};
$http.get('/games/' + game_id)
.success(function (data) {
$scope.gameInfo = data;
});
};