说我有以下代码:
App.PeopleView = Ember.View.extend
({
templateName: 'people',
people: Ember.ArrayController.create(
{
sortProperties: ['lastName'],
sortAscending: true,
contentBinding: Ember.Binding.oneWay('App.Mapper.person')
}),
Sort: Ember.View.extend(
{
templateName: 'people/sort',
isAscending: function()
{
alert('Here');
var rootView = this.nearestWithProperty('people');
return rootView.get('people').get('sortAscending');
}
.property('$root.people.sortAscending')
})
});
我希望能够在property()
属性上设置sortAscending
,但它属于父视图,我不知道如何引用它。 $root
不起作用,但我猜测它是如何工作的。