tomazahlin tomazahlin - 1 month ago 7
Javascript Question

Angular - ng-change not firing when ng-model is changed

The input is the following:

<input type="text" ng-model="repair.test" ng-change="action()" />

is executed when I manually type and change the input. However if I change the repair.test value by some other function programmatically, it doesnt fire the ng-change's action. I have read the angular tutorial and it's probably the expected behavior.

"The expression is not evaluated when the value change is coming from the model." <- I need this too.
How can I fire an action in controller, when the model changes in any way? (typing in input or by any other function)

Thanks for the help.


The model value is actually the
, which has it's own Form controller around it (I think), that is why I used the action function to try to pass the value to the parent controller. So
at the moment doesn't work, only when it is initialised.


ngChange is just for the input, if you want to listen the model do like this

$scope.$watch('repair.test', function(newvalue,oldvalue) {