Clearing the casing when leaving the route

I want to do some cleaning when I leave the route, for example, stopping timers. To do this, I need an event that fires when I exit the route, and I need access to the controller instance inside this event.

There is an event exit, but it does not receive any arguments, but inside this.get('controller')it does not work either - it returns undefined.

Is there a way to get a controller instance in an event, exitor maybe another event that I don't know about?

I am setting up this script with an example of what I want.

+5
source share
1 answer

, this.controllerFor('home'). JSFiddle.

, , this.controller, . JSFiddle.

+1

All Articles