Routing, dynamic parameters, link-to


I’m trying to get a route like this working: {
    this.route('due', { path: 'due-:when'});

And then link to like this:

{{#link-to 'due' 'past'}}Past Due{{/link-to}}
{{#link-to 'due' 'today'}}Due Today{{/link-to}}
{{#link-to 'due' 'tomorrow'}}Due Tomorrow{{/link-to}}

I feel like there is something fundamentally wrong in my understanding of how routing works, even after reading the docs and doing tutorials.

Could somebody please enlighten me?


Have you tried the path ‘due/:when’?

You can’t have a dynamic segment without it actually being a different segment (’/’ delimited) of the URL. That should give you what you want.

See “dynamic segments” in the docs:

If you are interested in seeing how the router parses dynamic segments:


Okay, that clears up one piece of the puzzle: dynamic “segments”. Got it. Thanks.


I decided to go with this: {
  this.resource('tasks', {path: '/'}, function () {
    this.route('dashboard', {path: '/'});

The number of urls is finite. That’s all my app will support. Adding more would be easy. It’s explicit. I can tell what urls are exposed just by looking at the router.

But now to figure out the next question.