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

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


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

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


The ngChange expression is only evaluated when a change in the input value causes a new value to be committed to the model.

It will not be evaluated:

  • if the value returned from the $parsers transformation pipeline hasnot changed
  • if the input has continued to be invalid since the modelwill stay null
  • if the model is changed programmatically and not by achange to the input value

Try to create a watcher using $scope.$watch - $watch(watchExpression, listener, [objectEquality]);

Example

$scope.$watch('repair.test', function(newValue, oldValue) {    // ...});


You can use a watcher-function in your controller

$scope.$watch('repair.test', function() {    $scope.action();});