Skip to content

Instantly share code, notes, and snippets.

@doowb
Created May 26, 2014 23:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doowb/8004d8ee761eedf6c395 to your computer and use it in GitHub Desktop.
Save doowb/8004d8ee761eedf6c395 to your computer and use it in GitHub Desktop.
Calling a namespaced Handlebars helper with / in the name.
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script type="text/x-handlebars" id="tmpl">
Property: {{bar}} <br />
Helper: {{[a/b] bar}}
</script>
<div id="output"></div>
<script src="example.js"></script>
</body>
</html>
$(function () {
Handlebars.registerHelper('a/b', function (foo) {
return foo;
});
var tmpl = $('#tmpl').html();
var fn = Handlebars.compile(tmpl);
var content = fn({bar: 'baz'});
$('#output').html(content);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment