Skip to content

Instantly share code, notes, and snippets.

@jubstuff
Last active August 29, 2015 14:26
Show Gist options
  • Save jubstuff/dfbec14a54862044339a to your computer and use it in GitHub Desktop.
Save jubstuff/dfbec14a54862044339a to your computer and use it in GitHub Desktop.
MarionetteJS Example - Static View
<div id="main-region">
<p>This is static</p>
</div>
<script type="text/template" id="static-template">
<p> This is a text rendered by our Marionette App. </p>
</script>
app = new Marionette.Application();
app.addRegions({
mainRegion: '#main-region'
});
app.StaticView = Marionette.ItemView.extend({
template: '#static-template'
});
app.on('start', function () {
var staticView = new app.StaticView();
app.mainRegion.show(staticView);
});
$(function () {
app.start();
});
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/backbone.marionette/2.4.2/backbone.marionette.min.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment