{{#linkTo}} and nested routes confusion

Hello friends,

I’m trying to build an Ember application and am currently experiencing a fair amount of frustration due to the following issue which I’ve outlined in a JSFiddle.

  • I have a basic route with one nested route.
  • Using the {{#linkTo}} helper, I’m able to navigate to the nested route.
  • However, I am unable to return to the parent route from the child.

It appears that the {{#linkTo}} helper depends on the context of the current view/route. Could someone please pity me and checkout this JSFiddle.

Update: I’ve managed to get around this issue by moving away from nested routes. This being said, I would still love to understand what I’m doing wrong in the JSFiddle I provided.

Just had a quick play with it

Any better?

To go INTO posts/whatever, you need an {{outlet}} in your posts template. Your back button will simply link back to posts/index, at least in this case.

This is roughly an explanation of @jabulmer121’s fiddle really.

I ran into pretty much the same issue yesterday, but I am using the {{action}} helper instead of {{#linkTo}}

Ember parent route - JSFiddle - Code Playground (correct working example)

I was just trying to transitionTo the category route passing context, when I needed to use category.index

1 Like