How can you manually (in the .js
file, not .hbs
) connect bindings from a component to the parent view's controller?
Per the documentation, it seems you should be able to bind a component property to the parent view's controller property. I know that the method I am about to describe used to work (around Ember v1.5).
var binding = Ember.Binding.from('inputValue').to('parentView.controller.outputValue');
binding.connect(this);
But now, parentView
and controller
don't exist. They seem to have been renamed to _parentView
and _controller
which suggests to me that it is not a "blessed" way of binding values from a component to it's parent controller.
So does anyone know if there is a way to do that, other than gumming up your .hbs
helpers with tons of ugly code?
{{component-helper ComponentVar1=ContollerVar1 ComponentVar2=ContollerVar2 ComponentVar3=ContollerVar3}}
// vs.
{{component-helper}}
Personally, I only need values to go one way (as shown when I try to hook things up manually using Ember.Binding
). So doing it through the helper in an .hbs
file is not only uglier, but also unnecessarily creates two-way bindings (I think).
Aucun commentaire:
Enregistrer un commentaire