handlebars like light template
var obj = {
greeting: "hello!"
};
var template = Handlebars.compile('<span>{{greeting}}</span>');
console.log(template(obj));
// <span>hello!</span>
- if
- unless
- each
- if else
- each else
block helper only
bracket syntax and dod syntax only
this expression is value > {{this}}
example
{{#each array}}
<span>{{this}}</span>
{{/each}}
this expression is object > {{this.key}} example
{{#each object}}
<span>{{this.foo}}</span>
{{/each}}
handlebars MIT
Copyright (C) 2011-2015 by Yehuda Katz
MIT source