Reputation: 344
I'm discovering Meteor and was asking myself for a thing. How in a template can we reverse the boolean into the handlebars from a template ?
There is an example of what I'm trying to do :
task.html
<li class="{{#if !checked}}checked{{/if}}">
...
But I'm getting an error "Expected close "}}". Maybe it's not possible.
Thank you !
Upvotes: 0
Views: 106
Reputation: 866
There is no !
syntax handling in the template.
Neither {{#if !myVar}} nor {{#if not myVar}} worked.
You need to remove !
from !checked
:
<li class="{{#if checked}}checked{{/if}}">
Or you can use unless
:
<li class="{{#unless checked}}checked{{/unless}}">
Upvotes: 1
Reputation: 1521
Here is your solution : How to IF NOT inside of {{ #each }} template
Use {{#unless}}
:
Example of use :
{{#unless checked}}
....
{{/unless}}
Upvotes: 1