Ember Routes Redirect

04/13/2013, Sat
Categories: #JavaScript
Tags: #Emberjs

From Index to Another Route

You want your root index route to redirect to another route such as when you are on the index URL (root_url) and you need to get to root_url/#/another_route. This may be useful because you wish to use the model information from another_route on initial page load. A downloadable demo is located below.

// Index Route to Another Route

App.IndexRoute = Ember.Route.extend({
  redirect: function () {
    // replace 'guitars' with your specific route name
    this.transitionTo("guitars");
  },
});

Download Demo