Is there an event or a hook that should be used to capture when a controller is initialized after being instantiated, or reinitialized for a specific route?
I've already tried init()
- but my controller is only instantiated once for the life of the application, but supports multiple models depending on the route. What I need to capture is when the model of the controller changes, or some moment after instantiation when the route changes.
I've also tried setting a computed property, but it isn't really appropriate, since I need an event to fire a function when the model changes - not only when the property is called.
Any help is very appreciated.
Edit: Aha! I completely looked over the fact that I can set observes()
on my function, so that it will fire when the model changes.
So, my answer was to do the following:
dependency: function() {
console.log('the model has changed');
//...other stuff...
}.observes('model')