【发布时间】:2011-07-23 17:41:18
【问题描述】:
通过 ajax 调用将下面的 HTML 注入我的网站,但没有提取模板。我需要做些什么来注册它吗?
无法解析绑定属性。留言:
参考错误:answerTmpl未定义;
属性值:template: { name: answerTmpl, foreach: answers }
动态 HTML:
<script id="answerTmpl" type="text/html">
<div>
<span></span> <input type="checkbox" name="Answer" />
</div>
</script>
<div id="answers" data-bind="template: { name: answerTmpl, foreach: answers }"></div>
对应的JS:
ko.applyBindingsToNode(document.getElementById('answers'));
【问题讨论】:
标签: knockout.js jquery-templates