Skip to content

Instantly share code, notes, and snippets.

@raymatos
Created February 7, 2013 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raymatos/4731621 to your computer and use it in GitHub Desktop.
Save raymatos/4731621 to your computer and use it in GitHub Desktop.
Subroutes in backbone?
app_router.on('route:showProjects', function(){
require(['views/projects/ProjectsView',],
function(ProjectsView){
//sub routes
var ProjectRoutes = Backbone.Router.extend({
routes : {
'clients/:id': 'showClients'
}
})
var projectRoutes = new ProjectRoutes();
projectRoutes.on('route:clients', function(id){
//require and run view
})
var projectsView = new ProjectsView();
projectsView.render();
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment