Backbone.js 主干:在jst.ejs文件中呈现动态内容
下面是Ryan Bates backbone.js的Rails教程。他使用jst.eco模板。但是,我使用的是jst.ejs文件 他的视图创建了一些他想插入到模板中的内容,即“条目转到此处” 它将被插入模板中的Backbone.js 主干:在jst.ejs文件中呈现动态内容,backbone.js,ejs,Backbone.js,Ejs,下面是Ryan Bates backbone.js的Rails教程。他使用jst.eco模板。但是,我使用的是jst.ejs文件 他的视图创建了一些他想插入到模板中的内容,即“条目转到此处” 它将被插入模板中的 <h1>App Name</h1> <%= @entries %> 注意,我没有使用coffeescript,在模板中的“条目”前面不需要@或“this” 视图/条目/索引 render: function(){ $(this.el).
<h1>App Name</h1>
<%= @entries %>
注意,我没有使用coffeescript,在模板中的“条目”前面不需要@或“this” 视图/条目/索引
render: function(){
$(this.el).html(this.template({
entries: "Entries go here"
}));
return this;
}
模板/条目/index.jst.ejs
<%= entries %>
render: function(){
$(this.el).html(this.template({
entries: "Entries go here"
}));
return this;
}
<%= entries %>