O'Reilly logo

Mastering Ember.js by Mitchel Kelonye

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Redirecting state

A common use of a handler is to redirect the application into another state in the same way we may be redirected to a 404 page if the requested resource was not found by the underlying server. In our sample app, the index controller overrides the route handler's redirect hook in order to redirect the application into the contacts state using the transitionTo method, as shown in the following code:

App.IndexRoute = Ember.Route.extend({
  redirect: function(){
    this.transitionTo('contacts');
  }});

There are two cases where we may need to perform this redirection. The first is when we don't need to know the model of the route handler. We used one of these hooks, beforeModel, to populate the contact list local store with fixtures just ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required