AngularJS enables us to create new directives so that we can encapsulate and simplify DOM manipulation. Custom directives are used to extend the functionality of HTML. A custom directive simply replaces the element for which it is activated.
Why would you need to create and use a custom attribute directive?
Attribute Directives are responsible for manipulating the appearance and behavior of DOM elements. We can use attribute directives to change the style of DOM elements. These directives are also used to hide or show particular DOM elements conditionally.
Can we create custom directive in AngularJS?
The directive allows you to create custom tags in AngularJS. By adding existing or custom Angular Directives, one can get the functionality work in the application. Technically AngularJS tells the browser while compiling, to attach behavior to the element or transform the DOM element.