Say I have a component that looks like this:
parent.component.js
...
template: `<div>
<child-one value="value" callback="callback"></child-one>
<child-two value="value"></child-two>
</div>`,
controller: function() {
this.callback = function(n) {
this.value = n;
}
}
...
Then the child components look like this:
childOne.component.js
...
bindings: {
value: '<',
callback: '<'
},
template: `<input type="text"
ng-model="$ctrl.value"
ng-change="$ctrl.callback($ctrl.value)"
/>`
...
childTwo.component.js
...
bindings: {
value: '<'
},
template: `<div>{{$ctrl.value}}</div>`
...
(binding technique thanks to krawaller)
I want the value that is set in childOne
to go to childTwo
. Updating the value
in childOne
does update the value
in the parent
but does not pass it down to childTwo
.