Skip to content
This repository has been archived by the owner on Oct 6, 2018. It is now read-only.

Latest commit

 

History

History
72 lines (51 loc) · 1.06 KB

handlebars-light.md

File metadata and controls

72 lines (51 loc) · 1.06 KB

handlebars-light

handlebars like light template

sample

var obj = {
  greeting: "hello!"
};

var template = Handlebars.compile('<span>{{greeting}}</span>');
  console.log(template(obj));
   // <span>hello!</span>

docs

built-in helpers

  • if
  • unless
  • each
  • if else
  • each else

api

registe helper

block helper only

paths

bracket syntax and dod syntax only

this context

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}}

thanks

handlebars MIT

Copyright (C) 2011-2015 by Yehuda Katz

MIT source