这可能不容易,但我很难弄清楚如何访问父视图的属性:
App.ParentView = Ember.View.extend({
foo: 'bar',
child_view: Ember.View.extend({
init: function(){
// get the value of App.ParentView.foo
// ???
}
})
});
Run Code Online (Sandbox Code Playgroud)
Tom*_*ore 30
要获得视图: this.get('parentView')
获得foo的价值 this.get('parentView.foo')