Reputation: 19114
I have modified the isDirty
property in my controller to also watch related controllers:
App.ItemController = Ember.ObjectController.extend({
needs: ['other'],
isDirty: function() {
return this._super() || this.get('controllers.other.isDirty');
}
});
The problem is that it needs to be a property, not a function, so I need to add something like:
isDirty: function() {
...
}.property('_super', 'controllers.other.isDirty')
but presumably referring to _super
won't work. How can I achieve this?
Upvotes: 0
Views: 318
Reputation: 37369
EDIT:
The question really is how to observe _super.
This makes things clearer. The answer is that you can't (not in the way you want to at least). Properties aren't like methods in the sense that you can't access the getter for a property in a child subclass in the overridden getter. A property is just a property; the getter is supposed to be an implementation detail. If you want to use that logic in the subclass, you can either duplicate that logic or you can not override the property by using a different name. I would suggest the latter.
App.ItemController = Ember.ObjectController.extend({
// isDirty inherited from superclass
anyDirty: Ember.computed.or('isDirty', 'controllers.other.isDirty')
});
Upvotes: 1