Route#redirect()

redirect (model, transition) public

Defined in packages/ember-routing/lib/system/route.js:1368

A hook you can implement to optionally redirect to another route.

If you call this.transitionTo from inside of this hook, this route will not be entered in favor of the other hook.

redirect and afterModel behave very similarly and are called almost at the same time, but they have an important distinction in the case that, from one of these hooks, a redirect into a child route of this route occurs: redirects from afterModel essentially invalidate the current attempt to enter this route, and will result in this route's beforeModel, model, and afterModel hooks being fired again within the new, redirecting transition. Redirects that occur within the redirect hook, on the other hand, will not cause these hooks to be fired again the second time around; in other words, by the time the redirect hook has been called, both the resolved model and attempted entry into this route are considered to be fully validated.

Parameters:

model Object
the model for this route
transition Transition
the transition object associated with the current transition
doc_EmberJs
2016-11-30 16:53:11
Comments
Leave a Comment

Please login to continue.