Last active
April 1, 2017 07:20
-
-
Save scott-w/56d5ff0c7b3c3e0806d3f298883e3cae to your computer and use it in GitHub Desktop.
Application Root
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
import {Application, View} from 'backbone.marionette'; | |
import _ from 'underscore'; | |
// If you use a navbar or panel | |
import {NavView} from './views/nav'; | |
// Your home page | |
import {IndexView} from './views/index'; | |
const RootView = View.extend({ | |
template: _.template('<nav id="nav-hook"></nav><div id="body-hook"></div>'), | |
regions: { | |
nav: '#nav-hook', | |
main: '#body-hook' | |
}, | |
onRender() { | |
this.showChildView('nav', new NavView()); | |
this.showChildView('main', new IndexView()); | |
} | |
}); | |
const App = Application.extend({ | |
region: '#root', // Your <div> identifier from before | |
onStart() { | |
this.showView(new RootView()); | |
} | |
}); | |
const app = new App(); | |
app.start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment