How can I bind a class to a view with the #view helper, if a boolean is FALSE?
// this is working
{{#view App.MyView controllerBinding="this" classBinding="controller.content.isActive"}}
<div>test</div>
{{/view}}
// and this is what i want:
{{#view App.MyView controllerBinding="this" classBinding="!controller.content.isActive:is-not-active"}}
<div>test</div>
{{/view}}
I want to bind is-not-active as a class name to the view, if controller.content.isActive is false.
I can make an simple inverter function on the view, but I there is a better way.
UPDATE: The Pull Request has been merged, so you can add a class for a
falsevalue like this:If you don’t want to add a class if the value is
true, you can use the following syntax:I would create a property on the view (like you already do with your inverter) and bind to this:
Handlebars:
JavaScript:
I’ve create a Pull Request which has not yet been merged but it addresses this issue and would solve it similar to this: