Inheritance 余烬财产观看超级

Inheritance 余烬财产观看超级,inheritance,ember.js,properties,Inheritance,Ember.js,Properties,我已修改控制器中的isDirty属性,以同时监视相关控制器: App.ItemController = Ember.ObjectController.extend({ needs: ['other'], isDirty: function() { return this._super() || this.get('controllers.other.isDirty'); } }); 问题是它需要是一个属性,而不是一个函数,所以我需要添加如下内容: isD

我已修改控制器中的
isDirty
属性,以同时监视相关控制器:

App.ItemController = Ember.ObjectController.extend({
    needs: ['other'],
    isDirty: function() {
        return this._super() || this.get('controllers.other.isDirty');
    }
});
问题是它需要是一个属性,而不是一个函数,所以我需要添加如下内容:

isDirty: function() {
    ...
}.property('_super', 'controllers.other.isDirty')
但是,大概引用
\u super
是行不通的。如何实现这一点?

编辑:

真正的问题是如何观察超级

这使事情更清楚了。答案是你不能(至少不是以你想要的方式)。属性与方法不同,因为您无法访问重写的getter中子类中的属性的getter。财产只是一种财产;getter应该是一个实现细节。如果要在子类中使用该逻辑,可以复制该逻辑,也可以不使用其他名称重写该属性。我建议后者

App.ItemController = Ember.ObjectController.extend({
    // isDirty inherited from superclass
    anyDirty: Ember.computed.or('isDirty', 'controllers.other.isDirty') 
});

这不是我想做的<代码>控制器。其他保持原样-我正在使用
\u super
调用
isDirty
的默认实现。您在谈论什么默认实现?据我所知,唯一的
isDirty
属性位于Ember数据模型上,您可以使用
model.isDirty
属性访问它。是的,但可以通过控制器上的属性访问它。不过,如果这能让问题更清楚,我可以参考覆盖
DS.Model
上的
isDirty
属性。真正的问题是如何观察
\u super