could you please tell me how to load precomplied templates .I googled it and find a solution .Now I don't know how to use this function.could you please tell me how to use this function ? code: http://goo.gl/ALfkzf
Backbone.Marionette.TemplateCache.prototype.loadTemplate = function (templateId, callback) {
var tmpId = templateId.replace("#", ""),
url = "/app/templates/" + tmpId + ".html";
$.get(url, function (templateHtml) {
compiledTemplate = Handlebars.compile($(templateHtml).html())
callback.call(this, compiledTemplate);
});
};
Backbone.Marionette.Renderer.renderTemplate = function (templateId, data) {
var renderer = $.Deferred();
Backbone.Marionette.TemplateCache.get(templateId, function(template){
var html = template(data);
renderer.resolve(html);
});
return renderer.promise();
};
I am trying to load html file which is inside the directory ? template/test.html
var ToolItemView = Backbone.Marionette.ItemView.extend({
template: 'template/test.html',
});