Reputation: 315
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
Upvotes: 10
Views: 14887
Reputation: 11303
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.
Upvotes: 18
Reputation: 2004
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
Upvotes: 8