惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
博客园 - 三生石上(FineUI控件)
GbyAI
GbyAI
大猫的无限游戏
大猫的无限游戏
M
MIT News - Artificial intelligence
Microsoft Azure Blog
Microsoft Azure Blog
月光博客
月光博客
Engineering at Meta
Engineering at Meta
I
InfoQ
T
Tailwind CSS Blog
N
Netflix TechBlog - Medium
S
SegmentFault 最新的问题
H
Help Net Security
博客园 - 【当耐特】
WordPress大学
WordPress大学
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
博客园 - 叶小钗
T
The Blog of Author Tim Ferriss
腾讯CDC
雷峰网
雷峰网
Martin Fowler
Martin Fowler
The GitHub Blog
The GitHub Blog
D
Docker

博客园 - gcg0036

亚信仨月印象(国庆时再写) 博客搬家了! log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "org.apache.log4j.Appender" variable. 模板引擎Crox用法大全(更新版) Apache Tomcat Maven Plugin 参数大全(Tomcat 6) Apache Tomcat Maven Plugin MyEclipse 2015 CI 12 无限试用 sshe源码分析——权限管理的后台部分 sshe源码分析——全局架构 无聊的三月终于过去了 failed to initialize monitor thread 在Android项目中的测试类点击"run as JUnit test"出错 Interacting with Other Apps Saving Data Managing the Activity Lifecycle Adding the Action Bar Building Your First App The AndroidManifest.xml File 高性能跨语言模板引擎Crox
handlebars简单用法
gcg0036 · 2015-03-02 · via 博客园 - gcg0036
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>handlebars</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script src="${base}/js/jquery1.11.min.js"></script>
<script src="${base}/js/handlebars-v3.0.0.js"></script>
</head>
<body>
    <div id=tt style='display: none'>
        <div class="entry">
            <h1>{{title}}</h1>
            <div class="body">{{body}}</div>
        </div>
    </div>
</body>
<script type="text/javascript">
    //$('#tt').before('<script id="temp" type="sfd">');
    //$('#tt').after("</ script>");//

    var source = $("#tt").html();
    //alert(source);
    var template = Handlebars.compile(source);
    var data = {title: "My New Post" , body: "This is my first post!"
    };
    var result = template(data);//将数据 填充到模板

    console.log(result);
    $('#tt').before(result);

</script>
</html>

posted @ 2015-03-02 01:31  gcg0036  阅读(422)  评论()    收藏  举报