Javatpoint Logo
Javatpoint Logo

AngularJS ng-change Directive

AngularJS ng-change directive specifies what to do when the user changes the value of an HTML element. The ng-change directive evaluates the expression immediately unlike the JavaScript onchange event which only triggers at the end of the change. It doesn't wait until all changes are made, or when the input field loses focus.

The ng-model directive must be presented to use ng-change directive.

Note: This ng-change directive is supported by the HTML tags like <input>, <select>, and <textarea>.

Syntax:

Parameter explanation:

expression: It specifies an expression that is executed when an element's value changes.

Let's take an example to demonstrate ng-change directive.

See this example:

Test it Now



Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA