vendredi 18 décembre 2015

how to add a class via binding in ember 2.0

I have a bootstrap button group in my Ember 2.2 app that looks like this:

 <div class='btn-group' role='group' aria-label='...'>
     <button type="button" class="btn btn-primary btn-xsm active={{aIsActive}}" >A</button>
     <button type="button" class="btn btn-primary btn-xsm active={{bIsActive}}" >B</button>
     <button type="button" class="btn btn-primary btn-xsm active={{cIsActive}}" >C</button>
</div>

'aIsActive', 'bIsActive', and 'cIsActive' are defined in the associated controller, and only one will be 'true' at a given time. The syntax shown above doesn't work. What's the proper way of doing this?




Aucun commentaire:

Enregistrer un commentaire