I want to make some cleanup when i leave route, like stopping timers. For that i need an event that triggers when leaving the route, and i need access to instance of controller inside of that event.
There is an exit
event, but it doesn't get any arguments, and this.get('controller')
inside it doesn't work too - returns undefined.
Is there a proper way for obtaining controller instance in the exit
event, or, maybe, another event that i don't know of?
I setup this fiddle with an example of what i want..
You can achieve this by calling this.controllerFor('home')
. You can try it in this JSFiddle.
This is a little bit annoying, so a pull request has been merged recently that allows you to directly use this.controller
, as you can see in this JSFiddle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With