What is Directives in AngularJS

Directives in angularJS extends HTML code to provide new behaviour. They are basically custom attributes in html by Angular JS. All directives starts with ng- or data-ng followed by directive name.

There are so may pre-defined directives available in angularJS and we can also create custom directives. In this article we will discuss only predefined directives and there uses.

Angular JS Directive Example

<body ng-app="">
</body>

Angular JS Directive with data attribute

<body data-ng-app="">
</body>

Always prefer data-ng directives as they validate HTML page on W3C validation. Using ng- can result in lot of W3C errors.

In angularJS we use ng keyword which means angular.

List of Directives in AngularJS

Hera is list of directives in Angular JS