Created
May 14, 2012 05:04
-
-
Save beriberikix/2691867 to your computer and use it in GitHub Desktop.
Handlebars noob
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Trying Handlebar</title> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0.beta6/handlebars.min.js"></script> | |
</head> | |
<body> | |
<div class="output"></div> | |
<script id="template" type="text/x-handlebars-template"> | |
<span>{{name}}</span> | |
</script> | |
<script type="text/javascript"> | |
var source = document.querySelector('#template'); | |
var template = Handlebars.compile(source); | |
var context = { name: "beriberikix" }; | |
var htmlOutput = template(context); | |
console.log(htmlOutput); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment