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.
10. The compiled Html is obtained by passing the context to the template. The context is the data JSON object.

Leave a Reply