Bird
0
0

In Angular, what role does the @Output decorator play when used in a child component?

easy📝 Conceptual Q1 of 15
Angular - Component Interaction
In Angular, what role does the @Output decorator play when used in a child component?
AIt marks a property as an input binding to receive data from the parent.
BIt allows the child component to send data to its parent via custom events.
CIt defines a service that the child component can inject.
DIt registers a lifecycle hook for the component.
Step-by-Step Solution
Solution:
  1. Step 1: Understand @Output

    The @Output decorator is used to define an event that a child component can emit to notify its parent.
  2. Step 2: Differentiate from @Input

    Unlike @Input, which receives data, @Output sends data out via events.
  3. Final Answer:

    It allows the child component to send data to its parent via custom events. -> Option B
  4. Quick Check:

    Sending data out from child to parent is done with @Output [OK]
Quick Trick: Use @Output to emit events from child to parent [OK]
Common Mistakes:
  • Confusing @Output with @Input
  • Thinking @Output is for dependency injection
  • Assuming @Output registers lifecycle hooks

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes