I was just wondering how you use the underscore templates in a .aspx view since the <%= %> tags that underscore uses get picked up by the .aspx rendering engine and give me errors.
For instance:
<script type="text/template" id="my-template">
<span class="event" title="<%= description %>">
<%= title %>
</span>
</script>
This template gives me an error since the .aspx rendering engine thinks I'm trying to bind this stuff to the Model.
Thanks.
From the fine manual:
So if the default
<%=...%>
,<%-...%>
, and<%...%>
delimiters aren't working for you then you can use different ones with a simple configuration change. For example, if you wanted to use{%...%}
instead of<%...%>
, then do this afterunderscore.js
is loaded and before you use_.template
:Demo: http://jsfiddle.net/ambiguous/TfB5M/