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):

ng-init:

ng-model:

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:

Controller:

Utilizing the above module & controller in our app:
  1. <html>
  2. <head>
  3. <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.17/angular.min.js"></script>
  4. </head>
  5. <body ng-app="tabmodule">
  6. <div ng-controller="tabcontoller">
  7. <div>
  8. Hello your Id is: <span ng-bind="id"></span><br />
  9. Hello your name is : <span ng-bind="name"></span>
  10. </div>
  11. </div>
  12. </body>
  13. </html>

In short, I can describe it as, the ng-controller will provide the information to Angular js, which the controller needs to be called in the view.

In our example, ng-controller="tabcontroller." so, ng-controller passes the name of the controller as "tabcontroller" to be called in that particular HTML section.