Florian JOLIVET
Florian JOLIVET

Reputation: 67

Combine class.bind with native class in HTML element in Aurelia

I'm currently trying to combine a class.bind attribute with a basic html class into an html component through a condition. Like:

<a href="#" class="stackpanel stretch" class.bind="myCondition == true ? 'myClass' :''">

And I want to get (if myCondition = true):

<a href="#" class="stackpanel stretch myClass">

Can you please tell me what's the best way to do this?

Upvotes: 1

Views: 283

Answers (1)

Jesse
Jesse

Reputation: 3622

You don't need to specify a class.bind along with the class, you can use the interpolation syntax along with the normal classes in a class attribute.

<a href="#" class="stackpanel stretch ${myCondition == true ? 'myClass' : ''}">

Upvotes: 2

Related Questions