KendoUI MVVM - 转义模板定义

时间:2015-08-20 22:20:37

标签: html5 visual-studio-2013 kendo-ui kendo-mvvm

是否有另一种方法来格式化这种类型的kendoUI模板定义而不是转义HTML字符?如果正斜杠未被转义,则visual studio编辑器会抱怨并且kendoUI库会抛出异常。

<div id="ordersToolbar"
     data-role="toolbar"
     data-items="[
                   {'template': '<label>Order Actions<&#47label>'},
                   {'type':'separator' },
                   {'type':'button','text':'Close','id':'closeButton' }
                 ]">
</div>

使用不使用此语法的模板定义:

    <div id="ordersToolbar"
     data-role="toolbar"
     data-items="[
                  {'template':'#=$("#orderActions").html()#'},
                  {'type':'separator' },
                  {'type':'button','text':'Close','id':'closeButton' }
                 ]">
    </div>


    <script type="text/x-kendo-template" id="orderActions">
        <label>Order Actions</label>
     </script>

1 个答案:

答案 0 :(得分:1)

我没有看到任何问题使用“/”说实话......在Visual Studio中也没有在jsbin: http://jsfiddle.net/leighking2/L9kLxpe1/

修改后的更新解决方案: http://jsbin.com/fusebosiye/1/edit?html,js,output