因此,我在Ember子路線attendee.search
內。從兒童路線過渡到父母路線時,灰燼掛鉤
我有一個按鈕,然後轉換回attendee.index
。
我需要在發生轉換時重置與會者列表的內容,但在從子路由轉到其父路由時不會調用setupController
,model
或redirect
。
每當用戶登陸attendee
路由時,如何運行一個函數?
因此,我在Ember子路線attendee.search
內。從兒童路線過渡到父母路線時,灰燼掛鉤
我有一個按鈕,然後轉換回attendee.index
。
我需要在發生轉換時重置與會者列表的內容,但在從子路由轉到其父路由時不會調用setupController
,model
或redirect
。
每當用戶登陸attendee
路由時,如何運行一個函數?
在App.AttendeeSearchRoute
上使用deactivate
掛鉤。
deactivate
掛鉤在去其他路線時會被擊中。如果你想知道,如果它要家長明確,檢查的App.AttendeeSearchRoute
actions: {
willTransition: function(transition) {
if(transition.targetName === 'attendee.index') {
// Going to the parent route...
}
}
}
像顯式一樣 –
這個
willTransition
動作不提供問題的答案。要批評或要求作者澄清,請在其帖子下方留言。 –修正了它。這不僅僅是一個問題,而是一個聲明。 – chopper