![]() |
VOOZH | about |
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:
Example 1: This example uses the ng-change Directive to display/hide some content using the checkbox.
Output:
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: