If you dig into Backbone's code a little, you'll notice that the router's implementation of navigate
in turn calls Backbone.history.navigate
:
// Simple proxy to `Backbone.history` to save a fragment into the history.
navigate: function(fragment, options) {
Backbone.history.navigate(fragment, options);
}
So instead of explicitly mucking up the global scope, use Backbone.history.navigate
:
var LandingView = Backbone.View.extend({
...
navigateToLogin: function(e){
Backbone.history.navigate("/login", true);
return false;
},
});