I have an ember application where I do some conditional redirecting, but would like to be able to pass the request on through to it's original location after the user has jumped through some hoops.
I've got something like this (coffeescript)
Ember.Route.reopen: ->
redirect: ->
if @controllerFor('specialOffers').get('should_offer')
#This next line is what I need help with
@controllerFor('specialOffers').set('pass_through', HOW_DO_I_GET_STRING_NAME_OF_CURRENT_ROUTE)
# After this property is set and the user interacts
# with the special offers, they will be redirected back
# to wherever they intended to go
@transitionTo('specialOffers')
This seems to work... but I don't know if it is a legitimate way to get this value.
JSFiddle Example
You want
currentPath
fromapplicationController
:Then in any of your controllers you can access the
currentPath
from theapplicationController
, by using theneeds
API (read about it here), as follows: