Reputation: 1771
I am working on ChaplinJS (backbone framework). Following is my route.js code block.
return function(match) {
match(':customer/getCardsNavSummary', {controller:'customer', action:'showPlan'});
match(':customer/getCardsNavSummary/:plan/:row', {controller:'customer', action:'showPlan'});
};
Instead, I want to do the following
return function(match) {
match(':customer/getCardsNavSummary(/:plan/:row)', {controller:'customer', action:'showPlan'});
};
This works well foe Backbone. I went through the routing code for rails also, and there it works. But when it comes to chaplinjs it don't !
In chaplinJS doc i did not find any thing related to router optional parameters.
Upvotes: 0
Views: 444
Reputation: 4442
Chaplin.Router
does not extend Backbone.Router
. As far as i know, what you trying to achieve is not possible with the Chaplin.Router
.
As your desired endpoint is the same for both routes (customer:showPlan), one possible workaround is to use the constraints option with a regexp that matches both getCardsNavSummary and getCardsNavSummary-plan-row pattern and then, in the Controller, check and parse this endpoint as needed.
Upvotes: 1