Attribute directives look like normal HTML attributes (possibly with data binding or event binding). they affect/change the element they added on, means they change the properties of the element. for example, changing the background color.Continue reading “Angular Custom Attribute Directive”
Directives are instructions in the DOM just like the components that are kind of instructions in the DOM but with a template.
We typically add directives with an attribute selector, but technically the selector of a directive can be configured just like the selector of a component,
In Angular we have some built in directives and they can be split into 2 categories:
- Structural Directives: NgIf, NgSwitch and NgFor.
- Attribute Directives: NgClass, NgStyle and NgModel.