![]() |
VOOZH | about |
The ng-controller Directive in AngularJS is used to add a controller to the application. It can be used to add methods, functions, and variables that can be called on some event like click, etc to perform certain actions.
Syntax:
<element ng-controller="expression"> Contents... </element>
Parameter value:
Example 1: This example uses the ng-controller Directive to display the input elements.
Output:
Example 2: This example uses the ng-controller Directive to display content after clicking the button.
Output: