Permalink
Browse files

basic model display

  • Loading branch information...
davidsulc committed Jun 28, 2014
1 parent 856d38b commit a5a36d3ffc6e3a71c29bee95082ba0269b70927e
Showing with 17 additions and 6 deletions.
  1. +17 −6 index.html
View
@@ -23,8 +23,8 @@
</div>
</div>
<script type="text/template" id="static-template">
<p>This is text that was rendered by our Marionette app.</p>
<script type="text/template" id="contact-template">
<p><%- firstName %> <%- lastName %></p>
</script>
<script src="./assets/js/vendor/jquery.js"></script>
@@ -36,8 +36,10 @@
<script type="text/javascript">
var ContactManager = new Marionette.Application();
ContactManager.StaticView = Marionette.ItemView.extend({
template: "#static-template"
ContactManager.Contact = Backbone.Model.extend({});
ContactManager.ContactView = Marionette.ItemView.extend({
template: "#contact-template"
});
ContactManager.on("before:start", function(){
@@ -53,8 +55,17 @@
});
ContactManager.on("start", function(){
var staticView = new ContactManager.StaticView();
ContactManager.regions.main.show(staticView);
var alice = new ContactManager.Contact({
firstName: "Alice",
lastName: "Arten",
phoneNumber: "555-0184"
});
var aliceView = new ContactManager.ContactView({
model: alice
});
ContactManager.regions.main.show(aliceView);
});
ContactManager.start();

0 comments on commit a5a36d3

Please sign in to comment.