Conditional line in handlebars.js with sugar

107 Views Asked by At

I am looking to get the following logic in Handlebars.js

  • the following line should appear in the output if foo is truthy

    xxx.yyy.zzz = {{foo}}

  • no line should appear if foo is falsy

How can I do it?

UPDATE:

  • I know I can wrap the line into an #if condition, but it's too wordy, is there a more elegant way?

UPDATE:

  • The question is rather:
    • Whether or not Handlebars can handle it without an #if wrap for a single line?
0

There are 0 best solutions below