millermedeiros / crossroads.js

JavaScript Routes
http://millermedeiros.github.com/crossroads.js/
1.44k stars 156 forks source link

Root page route? #108

Closed kokujin closed 10 years ago

kokujin commented 10 years ago

How is the root page matched? I cant get this to work

var rootRoute = crossroads.addRoute('');
var rootRoute2 = crossroads.addRoute('/');
rootRoute.matched.add(function(){
  console.log('root route');
});

var rootRoute2 = crossroads.addRoute('');

Can someone tell me what I'm doing wrong? Thanks

kokujin commented 10 years ago

It seems that I need to "parse" the route first as in:

crossroads.parse(document.location.pathname);