-
-
Save rstacruz/3088702 to your computer and use it in GitHub Desktop.
delete model
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
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