backbone.js - Marionnette layout not showing ItemView -
my layout isn't showing item view.
here markup:
<div id="wrapper"> <div id="header">header div</div> <div id="main">main div</div> </div>
here javascript:
var eventview = backbone.marionette.itemview.extend({ template: handlebars.compile("name of event: {{name}}"), model: new backbone.model({ name: "game" }), }); var applayout = backbone.marionette.layout.extend({ template: '#wrapper', regions: { header: '#header', main: '#main' } }); var layout = new applayout(); layout.render(); var event1 = new eventview(); layout.main.show(event1);
all want is
<div id="main">name of event: game</div>
i think first need insert layout inside app region.
app = new backbone.marionette.application(); app.addregions({ centerregion: '#center' }); var layout = new applayout(); app.centerregion.show(layout); var event1 = new eventview(); layout.main.show(event1);
Comments
Post a Comment