我有一個應用程序,我做了一些有條件的重定向,但希望能夠在用戶跳過一些圈之後將請求傳遞到它的原始位置。Ember.js RC1獲取路由名稱
我有這樣的事情(的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')
[本頁]上最後一個例子的第22行(http://emberjs.com/guides/routing/redirection/)也給出了這個理論的可信度;在這裏他們訪問'templateName'。謝謝! – wmarbut 2013-03-03 03:50:44
看起來它是一個內部屬性,所以要小心依靠它:https://github.com/emberjs/ember.js/commit/6e64bac6b53deae6a2263510c1bca7bcb88d31a4 – CraigTeegarden 2013-03-03 19:35:19
很好研究先生!我會離開接受這個答案,但也許有人像@ sly7_7可以擺脫一些像規範的方法 – wmarbut 2013-03-03 20:17:16