Reputation: 2611
Using backbone.js, is it possible to chain Url routes?
if I have something like that:
routes: {
"home*splat":"showHomeView",
"home/view_:param":"handleViewChange"
}
I'd like to be able to say something like .../#home/view_gallery and both handlers to fire in the order in which they were declared.
This however, fires only the first handler.
Upvotes: 0
Views: 305
Reputation: 1099
This makes for a perfect candidate for a backbone routing plugin that can extend Backbone's already existing Routing mechanism. I am in the process of building one and possibly can open source it when done.
Upvotes: 0
Reputation: 16361
The router runs through the keys
of routes
in order, and for the first one that matches, calls the Router[value].apply(params)
, and then stops.
So, no, URL routes will not chain. One route per URL hash change event.
Upvotes: 2