0
我是ICanHaz的忠實粉絲,我試圖直接將它整合到我正在構建的新的Marionette應用程序中。然而,去關this post,我寫了這個到達到渲染方法,並改變它的提線木偶:集成iCanHaz和Marionette
// Set up Initalizer
APP.addInitializer(function() {
//Reach into Marionette and switch out templating system to ICH
Backbone.Marionette.Renderer.render = function(template, data){
return ich[template](data);
}
//Create Router
new APP.Routers.GlobalRouter();
//Start Backbone History
Backbone.history.start();
});
如果我走通過這個功能,所有的數據似乎正常工作。但是,當投入使用並試圖將其用於佈局和項目視圖時,沒有任何內容被添加或插入。這是來自我的GlobalRouter:
//Grab the main Layout
var layout = new APP.Views.LayoutView();
//Render that layout
layout.render();
//Make the model
var userModel = new APP.Models.UserModel({
"user_name" : "[email protected]",
"tenant" : "Ginger Ale is Great"
});
//Make the Header Region
var headerRegion = new APP.Views.HeaderView({model: userModel});
layout.header.show(headerRegion);
這一切都發生在索引被命中時調用的方法中。沒有JS錯誤,所以我沒有什麼可繼續。然而,它在渲染函數中追加數據到正文,它會添加(但是破壞我的佈局和區域結構)。
我在index.html中存儲我的模板。
任何人都可以幫忙嗎?