Ember disabled button

13,389

Solution 1

The bind-attr syntax is deprecated:

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

And in your case you are passing a string not the isCancelled property therefore it is always true, {{bind-attr disabled=isCancelled}}> would work.

Solution 2

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

Make sure isCancelled is either TRUE or NULL. Only when it is null, 'disabled' won't be rendered

Share:
13,389
Osthekake
Author by

Osthekake

Updated on July 22, 2022

Comments

  • Osthekake
    Osthekake almost 2 years

    I'm having an issue with embers bind-attr on the 'disabled' attribute on a button. Basically I can't get it to not disable my button.

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

    Button looks like:

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

    It always renders the 'disabled' attribute.

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

    isCancelled: {{isCancelled}}
    

    It renders like: isCancelled: false

    I'm using Ember 1.12.0