3
納克級
我想做的事情是這樣的:從ng-class
如何檢查,如果事情是在陣列從
var list = [1,2,3,4,5]
if(2 in list){
return true
}
,所以我嘗試:
ng-class="this.id in list ? 'class-1' : 'class-2' ">
但沒有按」 t工作,拋出錯誤
Syntax Error: Token 'in' is an unexpected token at ...
現在是正確的:),+1 – alexmac
感謝它的工作! :) –
'ng-class =「list.indexOf(this.id)!== -1?'class-1':'class-2'」' –