kendo模板 Uncaught Error: Invalid template:' 报错

时间:2021-07-08 17:20:41
I was having a problem with a grid toolbar template because of a # in a href
Worked out that I needed to excape the # with \\\ and not \\

<script type="text/x-kendo-template" id="toolbarTemplate">
     <div class='toolbar'>
         <a id="createButton" class="k-button" href="\\\#">Create</a>
     </div>
</script>

and not

<script type="text/x-kendo-template" id="toolbarTemplate">
    <div class='toolbar'>
        <a id="createButton" class="k-button" href="\\#">Create</a>
    </div>
</script>

I suppose it is kind of obvious, but hopefully it will help someone...