What is the difference between double curly braces and triple curly braces for Handlebars.js

Viewed 14011

For instance, you can see {{{body}}} and in the templates, you are able to do something like {{data.page.hero.text}}

Is there any significant difference we should be aware of?

2 Answers

Depending on your use case and logic, you may add an option "noEscape" set to true when compiling the template if you want to use {{ }} when {{{ }}} are required to successfully replace the templates. For example: replacing with JSON values.

From the documentation:

var template = Handlebars.compile('{{foo}}', { noEscape: true });

noEscape: Set to true to not HTML escape any content.

Related