我有這個文件的test.html:Handlebarsjs並把模板到外部文件
<script id="entry-template" type="text/x-handlebars-template">
template content
</script>
var source = $("#entry-template").html();
var template = Handlebars.compile(source);
這樣我可以正確地看到我的模板,但因爲我有很多的模板來實現的,我想把這部分
<script id="entry-template" type="text/x-handlebars-template">
template content
</script>
到外部文件。
我使用phonegap,那麼我不能使用服務器端語言。 Handlebarsjs是一個在phonegap中實現模板的好東西嗎? 也許是更好的,如果我會加載模板(只有當我需要它)使用jquery.load?
謝謝