ng-class在ng-repeat中不起作用

时间:2022-12-02 20:33:05

This code is inside ng-repeat loop. The expression is not evaluating inside browser and the entire statement is their in browser also.

此代码位于ng-repeat循环内。表达式不是在浏览器内部进行评估,整个语句也是在浏览器中。

 <i ng-class="'icon-ok' : student.is_passed == 'passed', 'icon-remove': student.is_passed == 'failed'"></i>

1 个解决方案

#1


5  

You need to put your expression inside curly braces "{}"

你需要把你的表达式放在花括号“{}”里面

<i ng-class="{'icon-ok' : (student.is_passed == 'passed'), 'icon-remove': (student.is_passed == 'failed')}"></i>

#1


5  

You need to put your expression inside curly braces "{}"

你需要把你的表达式放在花括号“{}”里面

<i ng-class="{'icon-ok' : (student.is_passed == 'passed'), 'icon-remove': (student.is_passed == 'failed')}"></i>