27

How can I render this Meteor Blaze Template ? I would like to use the negative of the IF, but I don't find anywhere how to use it.

<ul>
{{#each pages}}
  {{#if (--NOT--) isCover }}
    <li> some content {{value}} </li>
  {{/if}}
{{/each}}
</ul>

Previous research not found solution https://github.com/meteor/meteor/wiki/Using-Blaze Check for equality in Spacebars?

Note: if I use only the if statement is working without problem, also I could do and else but I would like to have it only with the if(!isCover) solution

Community
  • 1
  • 1
ncubica
  • 8,169
  • 9
  • 54
  • 72

2 Answers2

50

You need to use the {{#unless}} block helper.

http://blazejs.org/

{{#unless isCover}}
  <li> some content {{value}} </li>
{{/unless}}
Saeed D.
  • 1,125
  • 1
  • 11
  • 23
saimeunt
  • 22,666
  • 2
  • 56
  • 61
  • 1
    Okay, that's a very weird, deviating approach, imho. Would it not have been more easier using `{{#if isCover unless }}`, rather, they've created a whole new tag for that. Not blazing at all – KhoPhi Dec 17 '15 at 21:53
0

Faced same issue, we created a Utility kind of method to invert the boolean values.

"invertBoolean" : function (inputValueBoolean) {
    return !inputValueBoolean;
  }

which can be used as below

 {{#if invertBoolean isCover }}
DKS
  • 306
  • 1
  • 2
  • 16