Created
February 1, 2014 12:59
-
-
Save rahmanusta/8752063 to your computer and use it in GitHub Desktop.
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="Basic Handlebars App" /> | |
<script src="http://code.jquery.com/jquery-2.0.3.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 id="book" type="text/x-handlebars-template"> | |
<div> | |
<p>{{name}}</p> | |
<p>{{author}}</p> | |
<p>{{price}}</p> | |
</div> | |
</script> | |
</body> | |
</html> |
This file contains 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
var html = $("#book").html(); | |
console.log(html); | |
var book = {}; | |
book.name="Java ve Yazılım Tasarımı"; | |
book.author="Altuğ Altıntaş"; | |
book.price=34; | |
var compiled = Handlebars.compile(html); | |
var result = compiled(book); | |
console.log(result); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment