//Create an application object
var application = new Marionette.Application();
//Add regions to the appplication.
//Shortcut for creating region objects.
application.addRegions({
header: "#header",
main: "#main",
footer: "#footer",
});
//Define the view
var MyView = Marionette.ItemView.extend({
template: '#my-view-template',
});
var HeaderView = Marionette.ItemView.extend({
template: "#headerTemplate"
});
var FooterView = Marionette.ItemView.extend({
template: "#footerTemplate"
});
//Define the model
var Person = Backbone.Model.extend({
defaults:{
firstName: "Homer",
lastName: "Simpson",
email: "[email protected]"
}
});
//Create person instance.
var person1 = new Person({
firstName: "Bart",
lastName: "Simpson",
email: "[email protected]"
});
//Instantiate the view.
var myView = new MyView({
model: person1
});
var headerView = new HeaderView();
var footerView = new FooterView();
//Show the view in the region specified.
//Application.Region.Show(myView)
application.header.show(headerView);
application.main.show(myView);
application.footer.show(footerView);
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.