You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<script id="template" type="text/x-handlebars-template">
<ol>
<li>{{dash 'abc' (concat a b)}}</li>
<li>{{dash d (concat a b)}}</li>
<li>{{dash c.c (concat a b)}}</li>
<li>{{dash (concat a b) c.c}}</li>
<li>{{dash (concat a e.e) c.c}}</li>
</ol>
</script>
<div id="rendered"></div>
JavaScript:
Handlebars.registerHelper('dash', function(a, b) {
return a + "-" + b;
});
Handlebars.registerHelper('concat', function(a, b) {
return a + b;
});
var template = Handlebars.compile($("#template").html());
$("#rendered").html(template({a: 'a', b:'b', c:{c:'c'}, d:'d', e: {e: 'e'}}));
HTML:
JavaScript:
jsfiddle: http://jsfiddle.net/beradrian/6T8ah/
The actual result is
and it should be
The text was updated successfully, but these errors were encountered: