in a very simple backbone app, I tried manipulating routes, I have them working, but I'm just wondering why the links to the homepage actually reload the page, when no other routes do reload.
Here's my router:
App.Router = Backbone.Router.extend({
routes: {
'': 'index',
'trips': 'trips',
'trips/new': 'newTrip',
'trips/:id': 'showTrip'
},
index: function(){
App.trips = new App.Collections.Trips ;
App.trips.fetch().then(function(){
new App.Views.App({ collection: App.trips });
});
},
trips: function(){
console.log('All trips') ;
},
newTrip: function(){
console.log('new trip') ;
var new_trip = new App.Views.Trip.New ;
$('#content').empty().append(new_trip.el) ;
},
showTrip: function(id){
console.log('trips id:' + id) ;
}
});