I am using Handlebars to handle conditionally building code that ultimately produces a PDF. I am using #if
in multiple places, and it works as expected:
<div class="entry">
{{#if author}}
<h1>{{author}}</h1>
{{/if}}
</div>
However, I am wondering about passing a more complex condition rather than simple existence. For instance, what if I want to run this block of code only if the value doesn't equal a particular string:
<div class="entry">
{{#if author !== 'admin' }}
<h1>{{author}}</h1>
{{/if}}
</div>
I also tried this:
<div class="entry">
{{#if (author !== 'admin') }}
<h1>{{author}}</h1>
{{/if}}
</div>
But this throws an error. Is there syntax I can use to do something like this within handlebars?