Prepare for Angular Interviews with real-life questions. Utilize quizzes and examples to deepen understanding and enhance your skills. Gear up to ace your interview!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


Which of the following is NOT one of the three types of directives in Angular?

  1. Component directives

  2. Structural directives

  3. Event directives

  4. Attribute directives

The correct answer is: Event directives

In Angular, directives are used to extend the functionality of HTML elements. There are three main types of directives: component directives, structural directives, and attribute directives. Component directives are essentially components themselves, encapsulating a template, styles, and logic, and they are represented in the code by a selector that allows the component to be used as an HTML tag. Structural directives are responsible for altering the DOM layout by adding or removing elements based on certain conditions. Common examples include directives like *ngIf and *ngFor, which control whether elements should appear in the DOM based on data conditions. Attribute directives, on the other hand, are used to modify the appearance or behavior of an existing DOM element without changing the layout. They can change the style of an element or respond to events. C, which is "event directives," is not a recognized category within Angular. While Angular does handle events (such as click events) through event binding, these are not categorized as a separate type of directive. Instead, such functionality typically utilizes attribute directives but does not have its own distinct classification within Angular's directive system.