Bird
0
0

What is the primary purpose of an Angular directive?

easy📝 Conceptual Q11 of 15
Angular - Directives
What is the primary purpose of an Angular directive?
ATo create new Angular modules
BTo add or change behavior on HTML elements
CTo define routes in the application
DTo manage HTTP requests
Step-by-Step Solution
Solution:
  1. Step 1: Understand what directives do

    Directives in Angular are used to add or change behavior on HTML elements, such as changing styles or responding to events.
  2. Step 2: Compare with other Angular features

    Modules organize code, routes manage navigation, and HTTP requests handle data fetching, which are not the main roles of directives.
  3. Final Answer:

    To add or change behavior on HTML elements -> Option B
  4. Quick Check:

    Directive purpose = Add/change behavior [OK]
Quick Trick: Directives change element behavior, not app structure [OK]
Common Mistakes:
  • Confusing directives with modules
  • Thinking directives manage routing
  • Assuming directives handle HTTP

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes