{{bind-attr}} not working with colspan why?

bind-attr not working with colspan

It works fine

@alexspeller Thank you, Ya it’s work for me but I want to set colspan count based on the property

like : <td {{bind-attr colspan='setColspan:2:1'}}>FOO</td>, how can achieve this one

@YIk like http://emberjs.jsbin.com/dogut/1/edit

@jasonmit Thank you, I did this workaround but I want use with single property.

like <td {{bind-attr class="showRed:redBG:yellowBG" }}>FOO</td here showRed is true apply redBG class otherwise apply yellowBG. Here we done with single property works, but colspan not work like this.

You cannot. Only classes work like this, not other attributes.

It does work:

<td {{bindAttr colspan="view.columnNumbers"}}

@Jun_Andrew_Hu thank you, but it’s also seems like workaround.

Hi, I used to have similar issues. It seems like a workaround because you’re trying to put logic into your templates, but handlebars kind of precludes you from doing this. It’s better to put the logic in the controller. Separation of concerns.

If you’re concerned about putting view logic on your controller, the above examples could just as easily go into the view.