AngularJS纳克级的前pression抛出错误 [英] AngularJS ng-class expression throwing error
本文介绍了AngularJS纳克级的前pression抛出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不能做这项工作,任何想法,我缺少的是什么?
I can't make this work, any idea what I'm missing?
<li ng-repeat="person in persons" ng-class="selected:currentPersonID===person.id">
显示 currentPersonID
和 person.id
显示相应的数据,但我得到一个角度解析错误与前pression。
Displaying currentPersonID
and person.id
shows the appropriate data, but I get an Angular parse error with that expression.
推荐答案
您应该写
<li ng-repeat="person in persons" ng-class="{'selected': currentPersonID === person.id}">
的 ngClass
文档说:
<ANY ng-class="{expression}">
...
</ANY>
大括号是必要有。
The curly braces are necessary there.
单引号内是在同一个页面上(我知道,应该是对官方的文档,但是......)
The single quotes are documented in a comment on the same page (I know, should be on the official docs, but...)
这篇关于AngularJS纳克级的前pression抛出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文