If you have been working on Angular you must heard the keyword Directive. What is Directives in Angular ?
Lets take a look!
Directive is a Decorator that marks a class as an Angular directive. You can define your own directives to attach custom behavior to elements in the DOM.
So how many types of Directives exist in Angular?
Basically, there are three types of Directives that exist in Angular. But it's not done you can also create your own Directive in Angular. Will discuss...
1 #Component Directive
Components are just directives with templates they use the directive API and give us a cleaner way to define them. it doesn't manipulate the Dom it creates them.
2 #Structural Directive
Structure directives manipulate the DOM elements. These directives have a * sign before the directive. For example, *ngIf and *ngFor etc.
3 #Attribute Directives
Attribute directives are used to change the look and behavior of the DOM element. For Example, NgStyle, NgClass etc.
Note* Structural Directive is used to manipulate the Dom while Attribute directives are used to change the look and behavior of the DOM element.