如何在ng-init中使用ng-repeat表达式添加if语句
<div ng-repeat="game in games">
<div ng-init="game.Present = (game.In == game.stock ? 1 : 0)"></div>
<div ng-init="game.Rated = (game.rated == game.userrated ? 1 : 0)"></div>
<img ng-src="GameCover.jpg" />
<div ng-show="(game.Present+game.Rated < 2">Promote Game image with flashy cover</div>
</div>
1和0只是一个开关,也可以是yes或no。这里的问题是,如何将if-else语句与ng-init一起使用。这当然是一个非常简化的示例。是否可以在and ng-init中添加一个if语句,并将其用作范围(如果不建议这样做)。另一个人该怎么做?