如何获取父的属性在Ember中查看? [英] How to get property of parent View in Ember?
本文介绍了如何获取父的属性在Ember中查看?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这可能是一件容易的事,但是我很难找出如何访问父视图的属性:
This is probably beyond easy, but I'm having a hard time to figure out how to access properties of parent views:
App.ParentView = Ember.View.extend({
foo: 'bar',
child_view: Ember.View.extend({
init: function(){
// get the value of App.ParentView.foo
// ???
}
})
});
推荐答案
要获取视图:为了获取foo的价值
this.get('parentView.foo)'this.get('parentView')
')
To get the value of foo this.get('parentView.foo')
这篇关于如何获取父的属性在Ember中查看?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文