I\'ve been upgrading my custom directives to the new component architecture. I\'ve read that components do not support watchers. Is this correct? If so how do you detect cha
A small heads-up regarding the use of ng-change
, as recommended with the accepted answer, together with an angular 1.5 component.
In case you need to watch a component that ng-model
and ng-change
do not work, you can pass the parameters as:
Markup in which component is used:
Component js:
angular
.module('myComponent')
.component('myComponent', {
bindings: {
onChange: '&',
fieldValue: '='
}
});
Component markup: