Skip to content

Instantly share code, notes, and snippets.

@julesbou
Created March 11, 2016 15:38
Show Gist options
  • Save julesbou/5553facfe88a22fc6889 to your computer and use it in GitHub Desktop.
Save julesbou/5553facfe88a22fc6889 to your computer and use it in GitHub Desktop.
/* .. code for router **/
loadView: function(index) {
var view = this.instanciateView(index);
this.views.push(view);
// unbind all events of the previous view to avoid 'ghost' views
if (this.currentView) this.previousView.remove();
$('#app').html(view.render().$el);
// store current view
this.currentView = view;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment