In AngularJS we have a lot of built-in directives which provide the functionality to our application.
Let's discuss the most commonly used directives to start sample programs.
ng-app (discussed in detail previously):
- It'sa directive that which bootstraps or initializes our application.
- ng-app is the root element of an AngularJS application, under which directives can be used to declare bindings and define behavior.

ng-init:
- This directive is used to intialize the data for the application.
- <html>
- <head>
- <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.17/angular.min.js"></script>
- </head>
- <body ng-app>
- <div ng-init="a=2"></div>
- <div>{{"it's init "+a}}</div>
- </body>
- </html>
- In the above example double curley braces are called as expressions.
- Expressions are used to bind the applications data to HTML
- Expressions are to be declared inside the {{ expression }} as we can see above example.
- Instead of expression {{ }} we can also provide the ng-bind="a"
- ng-bind or expression {{ }} can be used to bind the data to view.
ng-model:
- This directive povides the binding feature to the other directives as like input, select, textarea.
- Through ng-model we can also achieve two way binding, which is one of the main features of Angular JS.
Example:
- <html>
- <head>
- <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.17/angular.min.js"></script>
- </head>
- <body ng-app> <input type="text" ng-model="propname" /> {{propname}} </body>
- </html>
In the above example, we have used the ng-model with name "Propname" and that name we have used in regular expression as {{propname}}.
So, whenever the user provides the text, automatically the expression also comes with the typing text.
Module:

sai chandPosted Mar 5, 2016, 8:10 AM
this is nice explanation ... i have got lot of knowledge and so much interest regarding ur way of expressing.
shashidhar chPosted Mar 5, 2016, 7:35 AM
Good for Learning basic concepts....
Vignesh ManiPosted Mar 4, 2016, 11:50 AM
NIce