10
votes

I can't find how to make a link to the root route of my Ember app. I tried: {{#link-to 'index'}}Home{{/link-to}}, but in my console I get the exception: Assertion failed: The attempt to link-to route 'index' failed (also tried 'index.index'). The router did not find 'index' in its possible routes: 'loading', 'error', 'start.loading', 'start.error'

The same when I try {{link-to 'application'}}

This is my router:

App.Router.map(function() {
  this.resource('start', { path: '/start' }, function() {
    //.. sub routes ..
  });
  this.resource('intro', { path: '/' }, function() {
    // ...
  });
  this.route('login')
});
1
Can you post your router?claptimes
I edited my question to add the routerWillem de Wit
Honestly it seems likely whatever version of ember you're using is broken.Kingpin2k
@WillemdeWit Do you have an application route or an index route? If not, try adding an empty router with: App.ApplicationRoute = Ember.Route.extend({}); and the same thing for index. If that doesn't work, I agree with @kingpin2k... Sounds like you may be working with a broken version.Matthew Blancarte
Turns out that I have a route with path: '/' which is causing my problem. I needed a route to wrap some other routes but without expanding the url. So the route is just to create a wrapping template, is there another option?Willem de Wit

1 Answers

31
votes

Depending on what version you're using it used to just support index now application works as well for linking back to the root.

{{link-to 'Back to Home' 'application' }}

{{link-to 'Back to Home 2' 'index' }}

http://emberjs.jsbin.com/OxIDiVU/188/edit