How can I listen to angular component binding change and perform actions?
angular.module(\'myapp\')
.component(\'myComponent\', {
templateUrl: \'
I've discovered a way but not sure it's the most efficient. First bring in $scope as a dependency and set it to this._scope
or the like in your constructor. I have the following then in my $onInit
function:
this._scope.$watch(() => {
return this.items;
},
(newVal, oldVal) => {
// Do what you have to here
});
It's highly inspired by the answer here: Angularjs: 'controller as syntax' and $watch
Hope it helps, it's what I'm going to use until I'm told otherwise.