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}}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With