Skip to content

Instantly share code, notes, and snippets.

@rstacruz
Forked from anonymous/router
Created July 11, 2012 07:25
Show Gist options
  • Save rstacruz/3088702 to your computer and use it in GitHub Desktop.
Save rstacruz/3088702 to your computer and use it in GitHub Desktop.
delete model
movieDb.Router = Backbone.Router.extend({
routes:{
'': 'landPage',
'home': 'landPage',
'login': 'login',
'signup': 'signup'
},
landPage: function(p){
$('div#homepage').empty();
},
login: function(p){
this.cleanup()
this.current = new loginViews();
},
signup: function(p){
this.cleanup();
this.current = new signupViews();
},
cleanup: function(p){
// Tells the current view it's not needed anymore.
// This way, you can do some cleanup steps by overriding the
// view's `remove` method.
if (this.current) this.current.remove();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment