I am trying to add a class to the link attribute but the class name is conditional.
{{#link-to "role" this classNames="isLoading:is-loading" tag="tr" }}
<td {{ bind-attr class="isLoading:is-loading"}}>{{ name }}</td>
<td>{{ role }}: {{ isLoading }}</td>
<td>EDIT</td>
{{/link-to}}
So just like this. But somehow it doesn't work.
Is there another way to do this?
Just use classBinding
instead of classNames
:
{{#link-to "role" this classBinding="isLoading:is-loading" tag="tr" }}
<td {{ bind-attr class="isLoading:is-loading"}}>{{ name }}</td>
<td>{{ role }}: {{ isLoading }}</td>
<td>EDIT</td>
{{/link-to}}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.