HandleBars

let’s see an example.

[cc lang = “html”]
<div class=”xyz”>
<h1>{{title}}</h1>
<div class=”body”>
{{#noop}}{{body}}{{/noop}}
</div>
</div>

[/cc]

– The noop helper (short for “no operation”) will receive an options hash. This options hash contains a function (options.fn) that behaves like a normal compiled Handlebars template.

>Specifically, the function will take a context and return a String.

[cc lang = “javascript”]
Handlebars.registerHelper(‘noop’, function(options) {
return options.fn(this);
});

[/cc]


Posted

in

,

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *