Hogan.js用法
用它作为你的一部分资产打包编译模板提前或将它包括在你的浏览器来处理动态模板。
Hogan.js使用之前,先在引用Hogan.js。
<script src="hogan.js"></script>
Hogan.js使用方法:定义一组数据(data),通过Hogan.compile()方法编译,得到模版对象通过render()方法渲染数据。示例如下:
var data = {
screenName: "dhg"
};
var template = Hogan.compile("Follow @{{screenName}}.");
var output = template.render(data);
// prints "Follow @dhg."
console.log(output);