Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ember disabled button

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

like image 303
Osthekake Avatar asked Jul 31 '15 13:07

Osthekake


1 Answers

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.

like image 161
Patsy Issa Avatar answered Oct 22 '22 13:10

Patsy Issa