Bird
0
0

Given this child component code:

medium📝 component behavior Q13 of 15
Angular - Component Interaction
Given this child component code:
@Output() change = new EventEmitter<number>();
updateValue() {
  this.change.emit(42);
}

What will the parent component receive when updateValue() is called?
AAn event with value 42
BAn event with value 'updateValue'
CNo event emitted
DAn error because emit needs a string
Step-by-Step Solution
Solution:
  1. Step 1: Understand what emit does

    The emit method sends the given value (here 42) as an event payload to the parent.
  2. Step 2: Check the emitted value type

    The emitter is typed as number and emits 42, so the parent receives 42.
  3. Final Answer:

    An event with value 42 -> Option A
  4. Quick Check:

    emit(42) sends 42 to parent [OK]
Quick Trick: emit(value) sends that value to parent [OK]
Common Mistakes:
  • Assuming emit sends method name instead of value
  • Thinking emit requires string only
  • Believing no event is sent without explicit subscription

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes