{to-child}
One-way bind a value in the parent scope to the ViewModel.
Deprecated 3.8
This syntax is deprecated in favor of childProp:from="key"
{child-prop}="key"
Imports key in the scope to childProp
in viewModel. It also updates childProp
with the value of key
when key
changes.
<my-component {some-prop}="value"/>
Note: If key is an object, changes to the objects properties will still be visible to the component. Objects are passed by reference. See One Way Binding With Objects.
Parameters
- child-prop
{String}
:The name of the property to set in the component’s viewmodel.
- key
{Literal Expression|KeyLookup Expression|Call Expression|Helper Expression}
:An expression whose resulting value is used to set as
childProp
.
{$child-prop}="key"
Imports key in the scope to childProp
property or attribute on the element.
<input {$value}="name"/>
This signature works, but the following should be used instead:
<input value="{{name}}"/>
Use
{child-prop}="key"
is used to pass values from the scope to a component. You can use CallExpressions like:
<player-scores {scores}="game.scoresForPlayer('Alison')"/>
<player-scores {scores}="game.scoresForPlayer('Jeff')"/>