The ng-click Directive in AngluarJS is used to apply custom behavior when an element is clicked. It can be used to show/hide some element or it can popup alert when the button is clicked. The ng-click directive is a very handy tool used in AngularJS. When an HTML is clicked, the ng-click directive tells the AngularJS script what to do.
In this article, we will learn how to get many/multiple functions to the ng-click directive passed, in just one click.
<element ng-click="expression1(), expression2(), expression3()"> </element>
The key is to add a semi-colon (;) or a comma (,). All the functions must be separated by a (;) or a (, ). This syntax is supported by all the elements in the HTML. It is basically an expression that when clicked, gets executed.
Example: This example shows how to add more than one functions in one ng-click.
Before clicking on the button:
- After clicking on the button:
- How to Add Dynamic Options for Multiple Selects Inside ng-repeat Directive ?
- How many types of memory areas are allocated by JVM?
- How to see the changes in whole directory/folder containing many sass files ?
- How many levels of pointers can we have in C/C++
- Inverse functions and composition of functions
- Fruitful Functions and Void Functions in Julia
- AngularJS | ng-transclude Directive
- AngularJS | ng-model Directive
- AngularJS | ng-cloak Directive
- AngularJS | ng-csp Directive
- AngularJS | Directive
- AngularJS | ng-model-options Directive
- AngularJS | ng-jq Directive
- AngularJS | ng-include Directive
- AngularJS | input Directive
- AngularJS | textarea Directive
- Difference between Directive and Component in AngularJS
- How to add a box-shadow on one side of an element using CSS?
- Scala | Functions Call-by-Name
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.