I am trying to use javascript templates
<script type="text/x-tmpl" id="tmpl-demo">
<h3>{%=o.title%}</h3>
<p>Released under the
<a href="{%=o.license.url%}">{%=o.license.name%}</a>.</p>
</script>
The problem is – I want to include this inside my JS file ? How would I go about using the templates but inside my JS file where I assume I cant use the <script> tag ?
Currently, I do something like:
myFunction(id) {
return "<div>" + id + "</div>";
}
And I would like to convert that to templates instead?
You have basically four choices: