Handlebars: multiple conditions IF statement?

zwiebl picture zwiebl · Dec 20, 2016 · Viewed 22.6k times · Source

I didn't find this was possible in Handlebars... I need something like this:

{{#if A || B || C}} something {{/if}}

Is that possible to achieve? I have looked at this answer, but as I need for 3 variables (A, B, C) I don't really know how to apply it. Any ideas?

Answer

Harsha Vardhini picture Harsha Vardhini · Aug 18, 2017

They do not have multiple conditions. But you can achieve it by nesting. This works:

{{#if A}}
   {{#if B}}
     {{#if C}}
       something 
    {{/if}}
   {{/if}}
{{/if}}