How to use comments in Handlebar templates? How to use comments in Handlebar templates? javascript javascript

How to use comments in Handlebar templates?


Just add an exclamation mark after the opening brackets.

Normal Expression:

{{expressions}}

Commented Expression:

{{!expressions}}


Use this way in your handlebar template file.

<div class="entry">  {{!-- only output author name if an author exists --}}  {{#if author}}    <h1>{{author.firstName}} {{author.lastName}}</h1>  {{/if}}</div>

The comments will not be in the resulting output. If you'd like the comments to show up, then use HTML comments.

<div class="entry">  {{! This comment will not be in the output }}  <!-- This comment will be in the output --></div>

refer this link to