【发布时间】:2012-09-24 01:11:45
【问题描述】:
在我看来,我正在使用 .ejs 模板。但由于某种原因,视图不会加载给定的模板。它返回未定义。代码如下:
sandplate2.applicationView = Backbone.View.extend({
el: 'div',
template: _.template($("appl.ejs").html()),
initialize: function(){
console.log("Application view initialize");
_.bindAll(this, "render");
this.render();
},
render: function(){
console.log("Application view rendering");
this.$el.html(this.template());
return this;
}
});
我是否必须配置其他内容才能加载模板?
我使用 Yeoman 构建了我的应用程序。我使用了 init 和主干生成器。
仅供参考 - 我尝试加载的模板是使用脚本元素加载到 index.html 中的。
【问题讨论】:
标签: backbone.js yeoman