in Angular by
Q:
When do we use a directive in Angular?

1 Answer

0 votes
by

If you create an Angular application where multiple components need to have similar functionalities, you have to do it by adding this functionality individually to every component. This is not a very easy task. Directives are used to cope up with this situation. Here, we can create a directive with the required functionality and then import the directive to components that require this functionality.

Related questions

0 votes
0 votes
asked Feb 5, 2021 in Angular by SakshiSharma
0 votes
asked Sep 13, 2019 in Angular by ivor2019
+1 vote
asked Jul 5, 2021 in Angular by sharadyadav1986
+1 vote
asked Jan 24, 2022 in Angular by sharadyadav1986
...