I am using JsRender to construct my HTML page and I would like to be able to achieve the following.
<script id="qtype" type="text/x-jsrender">
<li class="question-container" data-type="{{:Question.Type}}">
{{include tmpl="#inner-template"/}}
</li>
</script>
What I would like to be able to do is to base the inner template inclusion upon some property within the model being rendered. For example, if my model has a property named 'Type' the following, whilst invalid synax, explains the requirement (hopefully)
{{include tmpl=:"#" + Question.Type}}
or, perhaps, using a 'helper' method:
{{include tmpl=~GetTemplateName(Question.Type)}}
I have tried adding the template name to the model, but I couldn't get that to work for the include statement:
{{include tmpl=templateName/}}
Can anyone tell me if this is possible, or perhaps an alternative suggestion?
Thanks.