YouTip LogoYouTip

Ng Ng Change

# AngularJS `ng-change` Directive [![Image 3: AngularJS Reference](#) AngularJS Reference](#) * * * ## AngularJS Example Execute a function when the input field value changes:

The input field has changed {{count}} times.

angular.module('myApp', []) .controller('myCtrl', ['$scope', function($scope) { $scope.count = 0; $scope.myFunc = function() { $scope.count++; }; }]); [Try it Β»](#) * * * ## Definition and Usage The **ng-change** directive tells AngularJS what to do when the value of an HTML element changes. The **ng-change** directive requires the `ng-model` directive to work. The AngularJS **ng-change** directive does not override the native onchange event. If the event is triggered, both the **ng-change** expression and the native onchange event will execute. The **ng-change** event is triggered on every change of the value. It does not wait for a complete modification process or for the element to lose focus. The **ng-change** event is only triggered for actual changes to the input value, not for changes made via JavaScript. * * * ## Syntax Supported by , , and