3
This question顯示如何獲取父視圖的屬性。訪問Ember中的父對象屬性的任何方法?
有沒有辦法與一般Ember.Object
s實現相同。例如如何做的App.Parent
的child
訪問屬性:
App.Parent = Ember.Object.extend({
parentProperty: 'someValue',
child: App.Child.create()
});
App.Child = Ember.Object.extend({
init: function(){
// I don't know which is my parent object
// but I still want to access the value of `parentProperty`
// var parentProperty = ???
}
});
不能總是這樣做,特別是如果父項是數組中的一個實例。 – knownasilya 2014-07-02 20:16:55