I am using backbone.js and underscore.js to build an javascript application. Since hours of reading and trying to run a template within a template like below, it is getting
I implemented this recently using backbone-relational. I created a fiddle that I thought might be helpful if you want to see a working solution: http://jsfiddle.net/blaisco/ADKrK/
I've posted the relevant bits below.
The view:
var FolderView = Backbone.View.extend({
el: $("#main"),
template: _.template($("#folder-tmpl").html()),
render: function () {
this.$el.html(this.template({
"folder": parentFolder.toJSON(),
"templateFn": this.template
}));
return this;
}
});
The html/template: