I read about templates with Mustache.js. I do not understand how to place the templates. I will not them in the same file.
$.get('test.htm', function(templates) {
// Fetch the <script /> block from the loaded external
var template = $(templates).filter('#tpl-greeting').html();
$('body').append(Mustache.render(template, templateData));
});
<script id="tpl-greeting" type="text/html">
<dl>
<dt>Name</dt>
<dd>{{name}}</dd>
<dt>Time</dt>
<dd>{{timeNow}}</dd>
</dl>
</script>
Should I create a controller that returns my template, or can I reference it?
source
share