Directives in angularjs?

Angularjs consist of many directives. Among them this 3 are main directives.

  1. Ng-app
  2. Ng-model
  3. Ng-click
  4. Ng-App:

The ng-app directive initializes an AngularJS application

  • Ng-model:

The ng-model directive binds the value of HTML controls (input, select, textarea) to application data.

  • Ng-click:

The click directive called the function and execute the code inside the function.


<!DOCTYPE html>


<script src=””></script>


<div ng-app=”” ng-init=”firstName=’John'”>

<p>Input something in the input box:</p>

<p>Name: <input type=”text” ng-model=”firstName”></p>

<p>You wrote: {{ firstName }}</p>





Leave a comment

Your email address will not be published. Required fields are marked *