Bird
0
0

Why does this parent component not receive the event?

medium📝 Debug Q7 of 15
Angular - Component Interaction
Why does this parent component not receive the event?
<app-child (notifyEvent)="handleNotify($event)"></app-child>

Child code:
@Output() notify = new EventEmitter<string>();
AParent listens to notifyEvent but child emits notify
BChild's EventEmitter is private
CParent method handleNotify is missing
DChild forgot to call emit()
Step-by-Step Solution
Solution:
  1. Step 1: Compare event names in parent and child

    Parent listens to (notifyEvent), but child emits notify event.
  2. Step 2: Identify mismatch causing no event reception

    Event names must match exactly for parent to receive events.
  3. Final Answer:

    Parent listens to notifyEvent but child emits notify -> Option A
  4. Quick Check:

    Event names must match exactly [OK]
Quick Trick: Event names in parent and child must match exactly [OK]
Common Mistakes:
  • Using different event names in parent and child
  • Assuming private modifier blocks events
  • Forgetting to emit events

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes