millermedeiros / crossroads.js

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

Unmatched routes #162

Closed codermak closed 2 years ago

codermak commented 2 years ago

Hi, Is there a way to find if there are no matching routes for current url. So that a invalid url message can be shown on the page.

eg. We have 2 routes configured crossroads.addRoute('#home', function () { console.log('home page') }) crossroads.addRoute('#page1', function () { console.log('page 1 page') })

Now if someone opens #unmatched instead of #home or #page1. Another function gets called

Something similar to this

crossroads.unmatchedRoute( function () { console.log('Unmatched page') })

codermak commented 2 years ago

https://millermedeiros.github.io/crossroads.js/#crossroads-bypassed

I found the solution here. Closing the question.