关于artTemplate不识别的问题

来源:互联网 发布:linux 安装squid 编辑:程序博客网 时间:2024/06/07 06:23

artTemplate是由腾讯公司开发的一个性能卓越、前后端通用的javascript模板引擎。

最近在学习nodejs+express的时候artTempalte出现不编译的情况。

在浏览器中检查该段代码如下所示。

<script src="javascripts/art-template.js"></script><script id="test" type="text/html"></script>

然而我在html里写的是这样的。

<script src="javascripts/art-template.js"></script><script id="test" type="text/html">  {{each data as value i}}  <tr>    <th>{{value.username}}       </th>    <th>{{value.conent}}         </th>  </tr>  {{/each}}</script>

调试了很久,发现是前后端模板发生了冲突,{{ }}里面的内容已经在后端被渲染过了,这就需要改一下后端artTemplate模板的开始和结束标签。然后在app.js里面加上这几句,把模板里的后端渲染部分的{{ }} 改为 <{ }>,问题解决。

template.config('openTag', "<{");template.config('closeTag', "}>");
0 0