Skip to content

Instantly share code, notes, and snippets.

@julesbou
Last active March 11, 2016 15:36
Show Gist options
  • Save julesbou/e83ef7a8ba71bfb7384f to your computer and use it in GitHub Desktop.
Save julesbou/e83ef7a8ba71bfb7384f to your computer and use it in GitHub Desktop.
var router = new Router();
Backbone.history.start();
// Load first view
window.location.hash = '#load/0';
// update model of the first view
views[0].model.set('name', 'John'); // => name is now: John
setTimeout(function() {
// Load a second view
window.location.hash = '#load/1';
// This is the problem, updating the model of the first view still
// triggers a “change” event although the view isn’t present in the DOM anymore
views[0].model.set('name', 'Balthazar'); // => name is now: Balthazar
}, 2000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment