I have an AngularJS 1.6 app that looks like this:
angular.module('app').component('parent', {
template: '
<parent>
<display options="ctl.options"></display>
<controls options="ctl.options"></controls>
</parent>',
controller: function() {
this.options = { x: 100, y: 0.2 };
},
controllerAs: 'ctl',
bindToController: true
});
I'd like to use inputs in controls component to modify properties of the options object, so that changes are reflected in display (but without rewriting entire object each time one property has been changed).
How can I do it? Even if I set options to two-way binding in controls, display is not updated and $onChanges does not fire.
It can be easily accomplished with $watch or messages, but I can't figure out a proper component-centric way to do it.