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


#1

bind-attr not working with colspan


#2

It works fine


#3

@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


#4

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


#5

@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.


#6

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


#7

It does work:

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

#8

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


#9

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.


#10

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