Since the introduction of HTMLBars in Ember, you've been able set attribute on elements in templates using boolean properties.
Here's the example from their docs located at http://guides.emberjs.com/v1.12.0/templates/binding-element-attributes/
Template:
<input type="checkbox" disabled={{isAdministrator}}>
HTML Output:
<input type="checkbox" disabled>
I'm trying to determine if their is a way to do the inverse. With this example, I want to set disabled only if isAdministrator is false.
Here's what I tried that does not work:
<input type="checkbox" disabled={{!isAdministrator}}>
That always results in disabled being applied regardless of the value of `isAdministrator.
In somecontroller.js:
var isABoolean = false;In sometemplate.hbs:
<button disabled={{!isABoolean}}>Do Stuff Only if isABoolean is true</button>
In the output.html
<button disabled>Do Stuff Only if isABoolean is tru</button>
Thanks @aortbals. Yep, both those approaches are cool. They don't work for my current situation, but I had another way of make it work. Was interested in the second part about the
!or other logic in the template. Makes sense. Not sure I agree with it, but suppose the line has to be drawn somewhere.