【发布时间】:2016-09-21 19:45:30
【问题描述】:
原来我的 index.html 是这样的:
<div data-bind="attr: {id: 'newsEntry_'+ $parentContext.$index() +'_lead_' + $index() + '_toolbar'}">
...
</div>
哪个有效!
我将该部分分离到一个外部 edit.html 文件中,并将其与 thymeleafs th:replace 包含到我的 index.html 中:
<div th:replace="fragments/editor :: editor(binding='data-bind=\'attr: {id: \'newsEntry_\'+ $parentContext.$index() +\'_lead_\' + $index() + \'_toolbar\'}\'')" >...</div>
片段/editor.html:
<div th:fragment="editor(binding)">
<div th:attr="${binding}">...</div>
</div>
我收到此错误:
org.thymeleaf.exceptions.TemplateProcessingException:无法解析 作为分配序列:"${binding}" (fragments/editor:9)
data-bind 是来自 knockout.js 的绑定。
我认为错误与“'\'”的转义有关
【问题讨论】:
标签: javascript java spring-mvc knockout.js thymeleaf