在尝试将视图中的值绑定到控制器中的值时,我遇到了一些单向绑定问题:
App.ApplicationController = Ember.Controller.extend({
value: 'my value'
});
App.ApplicationView = Ember.View.extend({
templateName: 'application',
willInsertElement: function() {
console.log('will insert element');
console.log('value from controller > ', this.get('controller').get('value'));
console.log('value > ', this.get('value'));
console.log('completeValue > ', this.get('completeValue'));
},
valueBinding: Ember.Binding.oneWay('controller.value'),
completeValueBinding: Ember.Binding.oneWay('App.ApplicationController.value')
});
“value >”返回正确的值,但“completeValue >”返回未定义(参见 jsFiddle http://jsfiddle.net/U29wV/7/)...