In js you can load a html template in the require part while defining a module. For example:
template file : test.html
<script id="test" type="text/template">
<div class="q-header-holder">
<h1> {{ quizName }}</h1>
<a href="{{ instructionLinks }}" class="q-instruction-btn">Instructions</a>
</div>
</script>
in module
define(
["template/test"],
function() {
//.. rest of code ..
}
);
But this throws error while fetching the file the filename appended with .js
extension. Is there any way to include the template in the define block?
Yep, use the text plugin - http://requirejs.org/docs/download.html#text
Some extra documentation can be found here - https://github.com/requirejs/text