Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 295
Anastasis Avatar asked Nov 08 '17 11:11

Anastasis


People also ask

What does double curly braces mean?

Template Values {} The double curly brackets are not HTML but scripting code. The term inside, interest, is a placeholder, sort of like the name and address in a form letter. The string {{interest}} will be replaced when the HTML template is converted into straight HTML that is sent over the network to the user.

What is the significance of double curly braces in angular application?

Displaying values with interpolationlink By default, interpolation uses the double curly braces {{ and }} as delimiters. Angular replaces currentCustomer with the string value of the corresponding component property. In this case, the value is Maria .

What is the purpose of curly braces?

Different programming languages have various ways to delineate the start and end points of a programming structure, such as a loop, method or conditional statement. For example, Java and C++ are often referred to as curly brace languages because curly braces are used to define the start and end of a code block.

What's wrong with double brace initialization in Java?

Disadvantages of Double Brace InitializationIt doesn't support the use of the “diamond operator” – a feature introduced in Java 7. It doesn't work if the class we are trying to extend is marked as final. It holds a hidden reference to the enclosing instance, which may cause memory leaks.


Video Answer


1 Answers

Handlebars HTML-escapes values returned by a {{expression}}. If you don't want Handlebars to escape a value, use the "triple-stash", {{{.

Reference: https://handlebarsjs.com/guide/expressions.html#html-escaping

like image 155
Bilal Sipra Avatar answered Oct 07 '22 17:10

Bilal Sipra