I am utilizing an ember resources as part of my application routing. I use deactivate on most of my routes to detect when it is changing, but can't seem to get it to work in my controller or view files. I have only seen success with deactivate when placing it in my route files. Is there a better way to go about this?
My main problem is that I need to detect when the page or route changes after another button and subsequent function have been called. The user process is as follows:
You can have an active
property on the controller that your button is bound to.
//yourcontroller.js
App.Yourcontroller = Ember.ObjectController.extend({
active: true
});
// template
{{#if active}}
<button>
{{/if}}
And change that value on the route's deactivate
// route.js
deactivate: function() {
this.controllerFor('yourcontroller').set('active', false);
}