将类添加到ember链接到 [英] Add class to ember link-to
问题描述
我尝试构建一个嵌套路由的链接,并希望为此链接添加一个类(对于twitter bootstrap)
结果应该是这样的: / p>
a href =/#/ rents / 42class =btn btn-primary btn-small>做某事< / A>
首先尝试:
{{#link-torentrent}}
给我一个链接到资源,但我不能指定(css)类。在文档中,我看到只有title属性可以被指定
第二次尝试:
< a href =/#/ rents / {{rend.id}}class =btn btn-primary btn-small> / A>
也是一个坏主意,因为Ember将在href中添加其帮助标签[自动更新]
那么我该怎么办?
使用: / p>
{{#link-to'rent'rent class ='btn btn-primary btn-small'}}去租{{/ link -to}}
由于 link-to
是一个视图助手。 p>
I try to build a link to a nested route and want to add a class to this link (for twitter bootstrap)
The result should something like this:
< a href="/#/rents/42" class="btn btn-primary btn-small">do something< /a>
First try:
{{#link-to "rent" rent}}
gives me a link to the ressource but I cannot specify a (css) class. In the docs I see that only the title attribute can be specified
Second try:
< a href="/#/rents/{{rend.id}}" class="btn btn-primary btn-small">do something< /a>
is also a bad idea, because Ember will add its helper tags [for automatic updates] in the href.
So what can I do?
Use:
{{#link-to 'rent' rent class='btn btn-primary btn-small'}}Go to rent{{/link-to}}
As link-to
is a view helper.
这篇关于将类添加到ember链接到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!