how to write nested if in ember htmlBars

376 Views Asked by At

how to write nested if conditition in ember htmlBars

<div {{bind-attr class=":class1 flag1:'acitve': flag2::'disabled'"}}>

below is ember verison

DEBUG: Ember : 1.13.0
Ember Data : 1.13.7
jQuery     : 1.11.1
1

There are 1 best solutions below

0
On BEST ANSWER

If you are using Ember 1.13, you should no longer be using bind-attr. Having said that, I don't see a nested if condition, and I just tried the code you have and it worked.

Here's how to do it in newer syntax:

<div class="class1 {{if flag1 'active'}} {{unless flag2 'disabled'}}">
  …
</div>