Ember.js: How to reference current route in #linkTo?

Created on 15 Jan 2013  路  2Comments  路  Source: emberjs/ember.js

Is it possible to tell the linkTo helper to automatically assume the specified route is nested within the current route?

Previously the action helper would automatically determine the current state, making it possible to do this:

<a {{action new href=true}}> New Post </a>

With the new router and linkTo helper, it seems it's now necessary to explicitly define the complete intended route:

{{#linkTo "posts.new"}} New Post {{/linkTo}

Is this indeed the case or am I missing something?

Most helpful comment

It's very useful, for example imagine having header/footer with language-select.
When user clicks on a language, app changes query-param (e.g: ?lang=fr).
Do you have any plans implementing this feature?

All 2 comments

Yes, you need to specify the "full route name". Remember that route names start over from each resource, so the names should be pretty short. See the routing guide for more.

It's very useful, for example imagine having header/footer with language-select.
When user clicks on a language, app changes query-param (e.g: ?lang=fr).
Do you have any plans implementing this feature?

Was this page helpful?
0 / 5 - 0 ratings