Default Routes in backbone.js
Add an additional route as the last route in your router:
'*path': 'defaultRoute'
and then handle it like this:
defaultRoute: function(path) {
this.doSomething();
}
This works since Backbone.js will match the routes in order, but will always match the 'splat' route.
http://stackoverflow.com/questions/6088073/default-routes-in-a-backbone-js-controller
Written by Bill Eisenhauer
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Backbone.js
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#