Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Backbone.Router and pushState
define( [
], function( $, _, Backbone, HomeModel, HomeView, ItemModel, ItemView ){
var Router = Backbone.Router.extend({
"": "home",
"/item": "item"
initialize: function(){
_.bindAll( this, "home", "item" );
home: function(){
var homeModel = new HomeModel();
new HomeView({
model: homeModel
item: function(){
var itemModel = new ItemModel();
new ItemView({
model: itemModel
return Router;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment