【发布时间】:2014-02-07 00:10:15
【问题描述】:
像往常一样,我使用link-to 帮助程序围绕我的应用程序提供一些移动。我正在尝试使用classBinding 属性将CSS 类hide 分配给链接。它不起作用,我不确定是因为我误解了上下文,还是真的。
这里是链接模板的相关部分:
{{#each SimpleSearchOptions}}
{{#if isResultsView}}
{{#link-to 'simpleSearchResults' tagName='li' classNames='chosentab' href=false}}
<a><span>{{qname}}</span><i class="icon-info-circled helpiconleft"></i></a>
{{/link-to}}
{{else}}
{{#link-to 'simpleSearchOption' this tagName='li' classNames='chosentab' classBinding='hidden:hide' href=false}}
<a><span>{{qname}}</span><i class="icon-info-circled helpiconleft"></i></a>
{{/link-to}}
{{/if}}
{{/each}}
这是它所基于的模型的一部分:
App.SimpleSearchOptions = [
{
"id" : 0,
"qname": "Application",
"description": "When you open a door you need one of these applications.",
"answers": [
{
"value" : "*",
"title": "Any / Unknown",
"description": "Unknown or variable Applications.",
"qname": "Application"
},
{
"value" : 1,
"title": "Building Temperature Control",
"description": "Prevents warm air from leaving a heated building or cool air from leaving an air-conditioned one.",
"qname": "Application"
},
.....
]
},
{
"id" : 7,
"qname": "Heating Power",
"description": "If a unit is heated using electricity, different amounts of power (in kW) are available.",
"hidden": true,
"answers": [
{
"value" : "*",
"title": "Any / Unknown",
"description": "",
"qname": "Heating Power"
},
{
"value" : "B",
"title": "6",
"description": "",
"qname": "Heating Power"
},
{
"value" : "C",
"title": "6.1",
"description": "",
"qname": "Heating Power"
},
......
第一个 {{#if ResultsView}} 工作只是在我后来动态地将一个元素添加到 SimpleSearchOptions 数组时找到。那为什么classBinding='hidden:hide' 不起作用呢?
感谢您的帮助。
【问题讨论】: