Skip to content

@oroce /router.js
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Backbone.Router and pushState
define( [
"jquery",
"underscore",
"backbone",
"models/home",
"views/home",
"models/item",
"views/item"
], function( $, _, Backbone, HomeModel, HomeView, ItemModel, ItemView ){
var Router = Backbone.Router.extend({
routes:{
"": "home",
"/item": "item"
},
initialize: function(){
_.bindAll( this, "home", "item" );
},
home: function(){
var homeModel = new HomeModel();
new HomeView({
model: homeModel
});
homeModel.fetch();
},
item: function(){
var itemModel = new ItemModel();
new ItemView({
model: itemModel
});
itemModel.fetch();
}
});
return Router;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.