I have a strange issue I haven't been able to figure out as of yet. It's very simple which is probably why I'm having trouble with it :)
First, here's the routing table...
routes: {
'': 'root', //called
'report': 'report', // called
'report/add': 'reportAdd', // not called
'report/print': 'reportPrint', // not called
'report/settings': 'reportSettings', // not called
},
You'll see I marked which ones are working and which ones aren't. The problem boils down to all subroutes (i.e report/add
) not being matched.
Backbone history is called properly in main.js like so:
app.Router = new Router();
Backbone.history.start({ pushState: true });
Obviously, that's in the right spot because routes are working just not sub-routes. I've tried the root
options of Backbone.history
and the silent parameter
all without any luck.
I imagine it's a configuration/setup issue but I haven't been able to find any answers. What am I doing wrong? Any help is much appreciated.
Btw, I'm using requirejs and Backbone Boilerplate but I don't see how that would make a difference.
UPDATE: Although the answer provided is technically correct, the problem is with Backbone Boilerplate. See the bottom of this blog post for an explanation. I'm having the same issue as the first commenter there.