Trick when switching from a child route to a parent route

So, I'm inside the Ember attendee.search route, attendee.search .

And I have a button, and the transitions back to attendee.index .

I need to reset the contents of the list of participants during the transition, but when switching from the child route to its parent call, neither setupController , model , nor redirect called.

How can I run a function every time a user lands on an attendee route?

+4
source share
2 answers

Use the deactivate hook on the App.AttendeeSearchRoute .

+5
source

The deactivate quest will fall upon transition to any other route. If you want to know if it will be specifically for the parent, check the willTransition App.AttendeeSearchRoute action

  actions: { willTransition: function(transition) { if(transition.targetName === 'attendee.index') { // Going to the parent route... } } } 
+4
source

All Articles