Silly question, maybe, but I can’t find a documented answer anywhere.
I’m trying to save a jquery tmpl template, and include it as a script. Seems like this should work:
<script src="my_tmpl.js" type="text/javascript" id="myTemplate"></script>
But no luck. What am I doing wrong?
Just for completeness’ sake, here’s the kind of binding I’m doing for knockout:
<div id="myTemplatedBox" data-bind="template: 'myTemplate'">
Edit: Here’s a very reduced version of the my_tmpl.js contents. It works fine when I keep it in the main html document.
<div class="headerText">{{html header_text}}</div>
{{each(i,v) answer_array}}
<div class="questionText"><input type="radio" name="Q${i}" value="${i+1}">{{html v}}</input></div>
{{/each}}
Take a look at http://encosia.com/jquery-templates-composite-rendering-and-remote-loading/
It looks like you still need the script tag in your template file.