How can I create simple conditional handlebar?
What I want to do is get from collections that if mood =='+'
, render the roll in white, else render some other color.
This is HTML:
{{#if moodIsPlus}}
<tr>
<td>
<strong>{{mood}} <i class="icon-hand-up" value="+"></i></strong> {{message}}<br>
</td>
</tr>
{{else}}
<tr class="info">
<td>
<strong>{{mood}} </strong> {{message}}<br>
</td>
</tr>
{{/if }}
which moodIsPlus is define in JS:
Template.messages.moodIsPlus = function() {
return Messages.find({mood:'+'});
}
and it returns everything.
By the way, are handlebars and handlebar.js the same thing? Where can I get more reference on handlebar in meteorjs?