I have a backbone.js router set up with some routes as follows :
routes : {
'a-route' : 'goToRoute',
'a-route/*splat' : 'goToRoute'
}
goToRoute : function(splat){
if(!splat) {
// do this
} else {
// do that with splat
}
When I do a
router.navigate('a-route', {trigger : true});
everything works just fine. But when I do
router.navigate('a-route/more', {trigger : true});
the router is firing twice : first with the splat equal to 'undefined', and then a second time with the splat equal to 'more'.
If I comment out the route 'a-route' : 'goToRoute', then everything works as it should with router.navigate('a-route/more') ... but I need both routes - with and without the splat.
According to the docs I think I have this set up correctly, any ideas?