我正在尝试设置这样一个类:
ng-class="{fa-disabled: cursorWait || wos.wordFormRowIsDisabled(wf)}"
如果cursorWait == true或者wos.wordFormRowIsDisabled函数返回true,我想要添加fa-disabled类。
但是这给了我一个运行计时器错误:
angular.js:13236 Error: [$parse:syntax] Syntax Error: Token '-' is unexpected, expecting [:] at column 4 of the expression [{fa-disabled:
cursorWait || wos.wordFormRowIsDisabled(wf)}]从[-disabled开始: cursorWait || wos.wordFormRowIsDisabled(WF)}]。 http://errors.angularjs.org/1.5.0/ $解析/语法P0 = - &安培; P1 =是%20unexpected%2C%20expecting%20%5B%3A%5D&安培; P2 = 4和; P3 =%7Bfa禁用%3AursorWait%20%7C%图7C%20wos.wordFormRowIsDisabled(WF)%7D&安培; P4 = -disabled%3A%cursorWait%20%7C%7C%20wos.wordFormRowIsDisabled(WF)%7D
有人可以提供帮助并告知错误吗?
答案 0 :(得分:2)
在ng-class
:
ng-class="{'fa-disabled': cursorWait || wos.wordFormRowIsDisabled(wf)}"
答案 1 :(得分:1)
绑定失败,因为除非引用该名称,否则在对象的属性名称中使用-
无效。
尝试
ng-class="{'fa-disabled': cursorWait || wos.wordFormRowIsDisabled(wf)}"
答案 2 :(得分:1)
如果班级有' - '介于两者之间。
ng-class="{'fa-disabled': cursorWait || wos.wordFormRowIsDisabled(wf)}"