Created
November 6, 2016 19:27
-
-
Save barlowm/561c48914943e7fc4d25278b18a348f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let App = new Marionette.Application(); | |
/* Load the Layout from layout.hbs */ | |
let MyLayout = Marionette.LayoutView.extend({ | |
template: TempLayout, | |
regions: { | |
HeaderR1: "#HeaderR" | |
} | |
}); | |
/* Load the View from header.hbs */ | |
let HeaderView = Marionette.ItemView.extend({ | |
template: header, | |
el: "#HeaderR" | |
}); | |
let container = new Marionette.Region({ | |
el: "#Header" | |
}); | |
let layout = new MyLayout(); | |
container.show(layout); | |
layout.render(); | |
let hv = new HeaderView(); | |
layout.HeaderR1.show(hv); // Show the Header Region | |
App.start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang=""> | |
<head> | |
<meta charset="utf-8"> | |
<title>Test</title> | |
<link rel="stylesheet" href="./css/app.css"> | |
</head> | |
<body> | |
<div id="Header"></div> | |
<script src="./index.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try the following:
Basically, a Marionette Region gets created for you when you show views inside a region manager (or
regions
, which is the same thing). This means you don't need theel
definition on the views or regions.The setup means you can just
showChildView
to render the parts you need as and when you need them.