Last active
August 29, 2015 14:26
-
-
Save jubstuff/dfbec14a54862044339a to your computer and use it in GitHub Desktop.
MarionetteJS Example - Static View
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
<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> |
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
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(); | |
}); |
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
<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