ich, wie etwas zu tun:
Wie kann man überprüfen, ob etwas in Array von ng-Klasse ist
var list = [1,2,3,4,5]
if(2 in list){
return true
}
von einem ng-class
, also habe ich versucht:
ng-class="this.id in list ? 'class-1' : 'class-2' ">
Aber doesn‘ t arbeitete, wirft einen Fehler
Syntax Error: Token 'in' is an unexpected token at ...
Jetzt ist es richtig :), +1 – alexmac
Danke, es hat funktioniert! :) –
'ng-class =" liste.indexOf (this.id)! == -1? 'Class-1': 'class-2' "' –