我试过了:
<li ng-repeat="todo in todos" class="{{todo.isCompleted ? 'test'}}">
<input type="checkbox" class="toggle"/>
<label>{{todo.text}}</label><button class="destroy"></button>
</li>
但后来我收到了一个错误:
Error: Lexer Error: Unexpected next character at columns 17-17 [?] in expression [todo.isCompleted ? 'test']
答案 0 :(得分:6)
答案 1 :(得分:2)
ng-class="{ 'test' : todo.isCompleted }"