Skip to content

Commit

Permalink
continue with template engine
Browse files Browse the repository at this point in the history
  • Loading branch information
binhtd committed Mar 17, 2015
1 parent 9454a53 commit 3ee607b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 6 deletions.
12 changes: 6 additions & 6 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,37 @@ <h1>{{firstName}} {{lastName}}</h1>
var html = Mustache.to_html(tpl, person);
$("#sampleArea6").html(html);
</script>

<p>Sample 7</p>
<p id="sampleArea7"></p>
<script>
var person = {
firstName: "tran hong",
lastName:"anh",
manager:{
firstName:"tran",
lastName:"le anh"
}
};
var tpl = "<h1>{{firstName}} {{lastName}}</h1> {{#manager}}Manager:{{firstName}} {{lastName}}{{/manager}}";
var html = Mustache.to_html(tpl, person);
$("#sampleArea7").html(html);
</script>

<p>Sample 8</p>
<p id="sampleArea8"></p>
<script>
var product = {
name: "an apple",
price:100 ,
tax:0.05,
totalPrice: function(){
return this.price * this.tax;
}
};
var tpl = "<p>Product name {{name}}</p><p>Price:{{totalPrice}}</p>";
var html = Mustache.to_html(tpl, product);
$("#sampleArea8").html(html);
</script>
</body>
</html>

0 comments on commit 3ee607b

Please sign in to comment.