Firing off button

I have a problem with bind-attr settings on the "disabled" attribute on the button. Basically, I can’t get him not to turn off my button.

isCancelled is a boolean in my model, according to this it should make it "disabled", appear and disappear inside the processed tag.

Button

looks like that:

<button {{action "cancel" provisioning}} {{bind-attr disabled="isCancelled"}}> 

It always displays the attribute "disabled".

I did a simple check to debug it. It looks like this:

 isCancelled: {{isCancelled}} 

It displays: isCancelled: false

I am using Ember 1.12.0

+7
source share
2 answers

The bind-attr syntax is deprecated:

 <button {{action "cancel" provisioning}} disabled={{isCancelled}}> 

And in your case, you pass the string, not the isCancelled property, so it is always true, {{bind-attr disabled=isCancelled}}> will work.

+15
source share

The problem is that if isCancelled is false, it will still display the disabled tag.

Verify that isCancelled is TRUE or NULL. Only when it is zero, "disabled" will not be displayed

+5
source share

All Articles