Bird
0
0

Given this child component code:

medium📝 component behavior Q4 of 15
Angular - Component Interaction
Given this child component code:
@Output() notify = new EventEmitter<string>();
sendMessage() {
  this.notify.emit('Hello');
}

What will the parent component receive when it listens to (notify)?
AUndefined
BThe string 'Hello'
CAn EventEmitter object
DA boolean true
Step-by-Step Solution
Solution:
  1. Step 1: Understand what emit sends

    The emit method sends the value passed to it to the parent event listener.
  2. Step 2: Identify the emitted value

    The child emits the string 'Hello', so the parent receives this string.
  3. Final Answer:

    The string 'Hello' -> Option B
  4. Quick Check:

    EventEmitter emits value = 'Hello' [OK]
Quick Trick: emit() sends the exact value to the parent listener [OK]
Common Mistakes:
  • Expecting the EventEmitter object instead of emitted value
  • Assuming undefined if no value is passed
  • Confusing emitted value with boolean

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes