Answered
In my Handlebars templates, I need to add if...else
conditionals to dictate what renders on certain pages.
I need it do something like this this:
<td>
if
<button>Is Owner</button>
else
<button>Not Owner</button>
</td>
Thanks for the help in advance!
In Handlebars, you can do something like this:
<td>
{{#if condition}}
<button>Is Owner</button>
{{else}}
<button>Not Owner</button>
{{/if}}
</td>
Based on the condition
value you pass to the template, one or the other version of the button will be used.
Handlebars has a built in {{#if}}
helper you can use.
More info here: https://handlebarsjs.com/guide/builtin-helpers.html#if.
They have a good example of an if...else
here: https://handlebarsjs.com/examples/builtin-helper-ifelse-block.html.