1

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?

Jesse
  • 3,522
  • 6
  • 25
  • 40
Florian JOLIVET
  • 67
  • 1
  • 1
  • 6

1 Answers1

2

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' : ''}">
Jesse
  • 3,522
  • 6
  • 25
  • 40