VOOZH about

URL: https://www.geeksforgeeks.org/angular-js/angularjs-ng-change-directive/

⇱ AngularJS ng-change Directive - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

AngularJS ng-change Directive

Last Updated : 11 Jul, 2025

The ng-change Directive in AngularJS is used whenever the value of an input element changes. The expression is evaluated immediately whenever there is a change in the input value. It requires an ng-model directive to be present. It is triggered whenever there is any single change in the input. It can be used with input elements like <input>, <textarea>, <checkbox> and <select>.

Syntax:

<element ng-change="expression"> 
 Contents... 
</element>

Parameter Value:

  • expression: It refers to the expression to execute whenever the value of input changes.

Example 1: This example uses the ng-change Directive to display/hide some content using the checkbox. 

Output:

👁 Image
 

Example 2: This example returns the number of times the state of the checkbox is changed and also the current state of the checkbox. 

Output:

👁 Image
 
Comment

Explore