Directives
AngularJS facilitates you to extend HTML with new attributes. These attributes are called directives.
Directives are markers on a DOM element that tell AngularJS to attach a specified behavior to that DOM element or even transform the DOM element and its children. In short, it extends the HTML.
Most of the directives in AngularJS are starting with ng- where ng stands for Angular. AngularJS includes various built-in directives. In addition to this, you can create custom directives for your application.
The following table lists the important built-in AngularJS directives.
Directive |
Description |
ng-app |
Auto bootstrap AngularJS application. |
ng-init |
Initializes AngularJS variables |
ng-model |
Binds HTML control's value to a property on the $scope object. |
ng-controller |
Attaches the controller of MVC to the view. |
ng-bind |
Replaces the value of HTML control with the value of specified AngularJS expression. |
ng-repeat |
Repeats HTML template once per each item in the specified collection. |
ng-show |
Display HTML element based on the value of the specified expression. |
ng-readonly |
Makes HTML element read-only based on the value of the specified expression. |
ng-disabled |
Sets the disable attribute on the HTML element if specified expression evaluates to true. |
ng-if |
Removes or recreates HTML element based on an expression. |
ng-click |
Specifies custom behavior when an element is clicked. |
AngularJS facilitates you to extend HTML with new attributes. These attributes are called directives.
There is a set of built-in directive in AngularJS which offers functionality to your applications. You can also define your own directives.
Directives are special attributes starting with ng- prefix. Following are the most common directives:
- ng-app: This directive starts an AngularJS Application.
- ng-init: This directive initializes application data.
- ng-model: This directive defines the model that is variable to be used in AngularJS.
- ng-repeat: This directive repeats html elements for each item in a collection.
For
More Explanation
&
Online Classes
More Explanation
&
Online Classes
Contact Us:
+919885348743
+919885348743