我像往常一样使用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'
不起作用呢?
感谢您的帮助。
答案 0 :(得分:0)
您应该使用classNameBindings
{{link-to 'Click to see the pretty colors!' 'colors' classNameBindings="isGreen:green"}}