vendredi 4 septembre 2015

Ember HTMLBars inline combined conditions

When trying to have a simple conditional style-class assignment in HTMLBars with Ember 1.13, the following code does a great job:

{{#each items as |item|}}
  <li class="tag {{if item.selected 'active' 'inactive'}}">{{item.key}}</li>
{{/each}}

Still, is there a way to combine conditions in the upper case, like checking for another condition? Something like the following code ...

{{#each items as |item|}}
  <li class="tag {{if (item.selected or noneSelected) 'active' 'inactive'}}">{{item.key}}</li>
{{/each}}

... or is the only way to achieve a check for several conditions via an Ember helper?

Thanks for your support!




Aucun commentaire:

Enregistrer un commentaire