Skip to content

Instantly share code, notes, and snippets.

@colinmegill
Created April 18, 2013 19:35
Show Gist options
  • Save colinmegill/5415598 to your computer and use it in GitHub Desktop.
Save colinmegill/5415598 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head></head>
<body>
<script type="text/javascript" src="handlebars.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<!-- this evaluates myContextObject.title -->
<script id="entry-template" type="text/x-handlebars-template">
<div>{{title}}</div>
</script>
<script type="text/javascript">
var myContextObject = {
"title": "My Title To Render"
};
var source = $("#entry-template").html();
var template = Handlebars.compile(source);
var output = template(myContextObject);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment