I'm using pushState, and not using hashes for the URL structure.
I have a route, and it has a few parameter bindings - some optional:
route: [
'chart/:chartType/:id',
'chart/:chartType/:id/:view?',
'chart/:chartType/:id/page/:page?',
'chart/:chartType/:id/:view?/page/:page?'
],
and then I've got my route-href, and I have the necessary bindings on there:
route-href="route.bind: chart; params.bind: { id: chartId, chartType: type, view: viewType, page: pageNum }"
...but what if I don't ALWAYS want all route parameters for a route-href
? As in, I'd like to be able to link to just a route that uses chartType and id without having to create separate routes for every single parameter combination I have on this route.
I know I can use "?" in the router config to designate a route optional, but how do I make the parameters optional in my route-href links?
Doing something like this throws an error:
route-href="route.bind: chart; params.bind: { id: chartId, chartType: type, view?: viewType, page?: pageNum }"
and I can't seem to use .bind
syntax, like this (which also errors):
route-href="route.bind: chart; params.bind: { id: chartId, chartType: type, view.bind: hasViewParam, page.bind: hasPageParam }"
What's the magic syntax trick here?