Advertisement
Guest User

Untitled

a guest
Jul 29th, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var App = Backbone.View.extend({
  2.     el: "body",
  3.  
  4.     initialize: function () {
  5.         this.router = new Router(this);
  6.         this.router.start();
  7.     }
  8. });
  9.  
  10.  
  11. var Router = Backbone.Router.extend({
  12.     initialize: function (app) {
  13.     this.app = app;
  14.         this.module = new Module();
  15.     },
  16.     start: function () {
  17.         this.app.$el.html(this.module.render().$el);
  18.     }
  19. });
  20.  
  21.  
  22. var Module = Backbone.View.extend({
  23.  
  24.     template: jst["module.hbs"],
  25.  
  26.     initialize: function (options) {
  27.         this.section = new Section();
  28.     },
  29.  
  30.     render: function () {
  31.         this.$el.html(this.template({ value: this.section.render().$el }));
  32.  
  33.         return this;
  34.     }
  35. });
  36.  
  37.  
  38. var Section = Backbone.View.extend({
  39.  
  40.     template: jst["section.hbs"],
  41.  
  42.     render: function () {
  43.         this.$el.html(this.template({ value: "Some val" }));
  44.  
  45.         return this;
  46.     }
  47. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement