2015-04-29 62 views
0

我想添加類來跨越ng-repeat中的值。如何使用angularJs加載類的值

我的HTML代碼

<div class="player"> 
    <span ng-repeat="cards in table.player.cards" class="a cards.card"></span> 
</div> 

價值控制器table.player.cards的是:

table.player.cards = [{"card":"CQ"},{"card":"C3"},{"card":"C5"}] 

我要分配cards.card的價值跨越。我該怎麼做?

+2

Err,'class =「a {{cards.card}}」'? – Phil

回答

1

做:

<div class="player"> 
    <span ng-repeat="cards in table.player.cards" class="a {{cards.card}}"></span> 
</div> 

您需要使用大括號,帶出該對象的值。

相關問題