Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Catch-all or error routes in Sammy.js

Is it possible to define a catch-all route or an error route in Sammy.js? I know I can bind to 'error' but if no route matches that does not seem to be triggered.

Thanks!

like image 550
luisgo Avatar asked Dec 20 '10 22:12

luisgo


1 Answers

You should override the notFound function.

Like this:

var app = $.sammy('#app', function() {
  this.notFound = function(){
    // do something
  }
});

This is recommended by the author of Sammy.

like image 118
jpbochi Avatar answered Oct 13 '22 22:10

jpbochi