Bird
0
0

What does adding standalone: true in an Angular pipe or directive decorator do?

easy📝 Conceptual Q11 of 15
Angular - Standalone Components
What does adding standalone: true in an Angular pipe or directive decorator do?
AIt disables the pipe or directive from being used in templates.
BIt allows the pipe or directive to be used without declaring it in an NgModule.
CIt makes the pipe or directive private to the module.
DIt automatically imports the pipe or directive into all components.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the role of standalone flag

    The standalone: true flag in Angular marks a pipe or directive so it does not require declaration inside an NgModule.
  2. Step 2: Effect on usage

    This means you can import the standalone pipe or directive directly into components without needing a module.
  3. Final Answer:

    It allows the pipe or directive to be used without declaring it in an NgModule. -> Option B
  4. Quick Check:

    standalone: true means no NgModule needed [OK]
Quick Trick: Standalone means no NgModule declaration needed [OK]
Common Mistakes:
  • Thinking standalone makes directive private
  • Assuming standalone disables usage
  • Believing standalone auto-imports everywhere

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes