Created
June 24, 2012 13:30
-
-
Save alexandernst/2983237 to your computer and use it in GitHub Desktop.
Backbone Views creation
This file contains hidden or 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
window.App = Backbone.Router.extend({ | |
initialize: function(){ | |
this.route(/^$/, 'mainPage'); | |
} | |
mainPage: function(){ | |
console.log("Showing main page..."); | |
var content = $('#content'); | |
content.empty(); | |
var menuView = new MenuView(); | |
content.append(headerMenuViews.render().el); | |
var mainContentView = new MainContentView({ | |
model: someModel | |
}); | |
content.append(mainContentView.render().el); | |
//You can also append the content of one or more views to a DIV | |
var specialPlaceOnPage = $("<div></div>").appendTo(content); | |
var fooView = new FooView(); | |
specialPlaceOnPage.append(fooView.render().el); | |
var barView = new BarView(); | |
specialPlaceOnPage.append(barView.render().el); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment