Bird
0
0

Why is it important that directives in Angular follow a clear selector naming convention like prefixing with 'app'?

hard📝 Conceptual Q10 of 15
Angular - Directives
Why is it important that directives in Angular follow a clear selector naming convention like prefixing with 'app'?
ATo automatically generate documentation
BTo make directives load faster in the browser
CTo avoid conflicts with standard HTML elements and other libraries
DTo ensure directives are only used in root modules
Step-by-Step Solution
Solution:
  1. Step 1: Understand naming conventions purpose

    Prefixing selectors prevents name clashes with native HTML or third-party libraries.
  2. Step 2: Evaluate options for naming benefits

    Only avoiding conflicts matches the reason for prefixing selectors.
  3. Final Answer:

    To avoid conflicts with standard HTML elements and other libraries -> Option C
  4. Quick Check:

    Selector prefixing prevents conflicts [OK]
Quick Trick: Prefix selectors to avoid naming conflicts [OK]
Common Mistakes:
  • Thinking prefix improves performance
  • Believing prefix restricts module usage
  • Assuming prefix auto-generates docs

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes