Handlebarjs

Posted on by By Somen Sarkar, in Front End, Javascript | 0

Handlebarjs quick facts

1. Handlebar.js is a powerful templating engine based on the Mustachejs.
2. Handlebarjs can be added using the <script>// tag with local repository or using a cdn link.
3. This templating engine uses {{ }} symbol exclusively thus they resembel the handlebars of a cycle.
4. Any variable insied the {{ }} are replaced dynamically eg. {{titleName}} in
Welcome to the {{titleName}}
5. By default there is html escaped
6. The javascript values can be accessed using the dot notation hence reduce coding time. eg. {{ address.street }}
7. HTML escape is provided by default hence it takes care of the HTML injection by default.
8. We can also disable the HTML escape feature of the handlbar using {{{ }}} tripple braces.
9. After writing the code we need to use the following statement in our javascript to get it compiled.
Handlebars.compile(source)
10. The compiled Html is obtained by passing the context to the template. The context is the data JSON object.

logo

Best Open Source Business Intelligence Software Helical Insight is Here

logo

A Business Intelligence Framework

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments