How to set default params in can.Control.route

116 Views Asked by At

When using the can.Control.route documented here, I can not manage to set default parameters values as it is possible when using the classical declarative way as follow :

can.route("content/:type", {type: "videos" });

Is there a way to set the default value of a router parameter when using the route Control ?

Thanks for assistance.

1

There are 1 best solutions below

2
On BEST ANSWER

You should be able to define the route in your control and then set the default value as described above:

can.Control.extend({
  'content/:type route': function() {
    //
  }
});

can.route("content/:type", { type: "videos" });