I have an issue with templates inside of templates in jsrender. Or rather, it actually does work, as long as I have it in script blocks on the page, like so:
<script id="template_1" type="text/x-jsrender">
<h2>{{>Title}}</h2>
<ul>
{{for Details tmpl="#template_2" /}}
</ul>
</script>
<script id="template_2" type="text/x-jsrender">
<li>
{{>Headline}} - {{>Text}}
</li>
</script>
However, when I wish to move template_2 to an external file to use other places, I cannot seem to have it work again. I tried creating another tag in the direction of:
$.views.converters({
insertDetailList: function (data) {
$.get('/templates/_details.tmpl.htm', null, function (template) {
var tmpl = $.templates(template);
});
}
});
When I return the template however (rendered or not), it returns 'undefined'. Any ideas for how to get this to work? I have plenty of templates with this setup that I would like to have exported to separate files for use in more places :)