summaryrefslogtreecommitdiffstats
path: root/demo/demo.html
diff options
context:
space:
mode:
authornimojs <imhadley@163.com>2015-04-19 23:14:19 +0800
committernimojs <imhadley@163.com>2015-04-19 23:14:19 +0800
commitcbaf08642e63b1dc50b99ba5ac41ea1ecc4b7163 (patch)
tree2d2d55cfbd5e9b89a99223d2e30037ed4ba14cae /demo/demo.html
parent720cb5a6ba938cb9864bd24d6df5527b5cdbfa91 (diff)
downloadhandlebarsjs.org-master.zip
handlebarsjs.org-master.tar.gz
handlebarsjs.org-master.tar.bz2
增加章节,静态资源文件目录调整
Diffstat (limited to 'demo/demo.html')
-rw-r--r--demo/demo.html25
1 files changed, 15 insertions, 10 deletions
diff --git a/demo/demo.html b/demo/demo.html
index 603a7ac..03b3760 100644
--- a/demo/demo.html
+++ b/demo/demo.html
@@ -23,27 +23,32 @@
<!-- 模板 -->
<script class="show" id="source" type="text/x-handlebars-template">
-{{{link "See more..." story.url}}}
+{{#nimo}}
+{{.}} {{root.a.b.c}}
+{{/nimo}}
</script>
<!-- 数据 -->
<script class="show json-format-error" id="data" type="text/json">
{
- "story": {
- "url": "http://www.handlebarsjs.org"
- }
+ "a":{
+ "b":{
+ "c":"cccc"
+ }
+ },
+ "nimo": [
+ 1
+ ,
+ 2
+ ]
}
</script>
<!-- helper实现 -->
<script class="show" id="helper">
-Handlebars.registerHelper('link', function(text, url) {
- url = Handlebars.escapeExpression(url);
- text = Handlebars.escapeExpression(text);
+Handlebars.registerHelper('helper-name', function(obj) {
+ return 'output'
- return new Handlebars.SafeString(
- "<a href='" + url + "'>" + text + "</a>"
- );
});
</script>
<!-- 渲染结果字符 -->