Bind-attr with a sequence


Is there a better way to manage a {{bind-attr class="isActive:active"}} with a sequence where anything below a certain number is set with the ‘active’ class?

A use-case example would be a sequence of steps. When the current step is 3 (out of 5), steps 1 through 3 have the “active” class.

Here’s one way I got it working:

working demo jsbin edit link



You can create a component for your steps. This cleans it up quite a bit I think.


Thanks for the feedback, @maxn! Moving this all to components seems to be the best way to do this, thanks.

So i created a component for the steps indcators, each step indicator, the controls, and step content.

Here’s the result: preview and edit