Javascript ICanHaz未检测到模板
我已经查看了关于这个主题的其他帖子,但是没有一篇与我的问题相匹配。以下是我的模板的代码:Javascript ICanHaz未检测到模板,javascript,template-engine,icanhaz.js,Javascript,Template Engine,Icanhaz.js,我已经查看了关于这个主题的其他帖子,但是没有一篇与我的问题相匹配。以下是我的模板的代码: <script id ="postingcell" type="text/html"> <li class="postinglistcell"> <div class = "postinfowrapper"> <table class="centermargins"> <tr
<script id ="postingcell" type="text/html">
<li class="postinglistcell">
<div class = "postinfowrapper">
<table class="centermargins">
<tr>
<td>
<div class="posttitle">{{Title}}</div>
</td>
</tr>
</table>
</div>
</li>
</script>
我可能会得到一个错误,告诉我没有定义
ich[“postingcell”]
,但它已经在上面的脚本标记中。有人知道我做错了什么吗?ICanHaz也使用jQuery进行设置。一个可能的原因是代码在调用ich.grabTemplates()之前运行
if (ich.$) {
ich.$(function () {
ich.grabTemplates();
});
}
您可以尝试在代码中调用ich.grabTemplates():
$(document).ready(function() {
ich.grabTemplates();
var p = ich["postingcell"](thisobj);
});
ICanHaz还使用jQuery进行设置。一个可能的原因是代码在调用ich.grabTemplates()之前运行
if (ich.$) {
ich.$(function () {
ich.grabTemplates();
});
}
您可以尝试在代码中调用ich.grabTemplates():
$(document).ready(function() {
ich.grabTemplates();
var p = ich["postingcell"](thisobj);
});
看起来您在
id
和=“postingcell”
之间有一个空格。这是完全相同的代码吗?它是。。。但是只要它在字符串之外,这个空格就不重要了,对吗?看起来在id
和=“postingcell”
之间有一个空格。这是完全相同的代码吗?它是。。。但是这个空间应该不重要,只要它在字符串之外,对吗?