Late answer (more than a year) .. but you can use RegEx in the base router to achieve this. My example assumes parameters start with a number.
i.e.: localhost: 8888 / # root / 1param / 2param
var router = Backbone.Router.extend({ initialize: function () { // Use REGEX to get multiple parameters this.route(/root/, 'page0'); this.route(/root\/(\d+\S+)/, 'page1'); this.route(/root\/(\d+\S+)\/(\d+\S+)/, 'page2'); }, page0:function(){ console.log("no id"); }, page1:function(id1){ console.log(id1); }, page2:function(id1,id2){ console.log(id1); console.log(id2); } });
Hope this helps.
source share