backbone.js - BackboneJS, MarionetteJS - Trying to display layout + regions -
i've got following code
$ -> class mainlayout extends marionette.layout template: handlebars.compile $("#main_layout_hb").html() regions: header : "#header" options : "#options" footer : "#footer" class mainregion extends marionette.region el:"#main_wrap" class app extends marionette.application main_region : new mainregion main_layout : new mainlayout onstart: => @main_region.show(@main_layout) # start backbone history url routing if backbone.history backbone.history.start() app = new app app.start()
i'm trying follow example on page https://github.com/marionettejs/backbone.marionette/wiki/the-relationship-between-regions-and-layouts
but when run code, don't template "#main_layout_hb" inserted region. what's going on there?
you should create app's region using addregions method:
app.addregions main_region: "#main_wrap"
Comments
Post a Comment