Bird
0
0

You want to send a number from child to parent and also pass additional info. Which approach correctly sends both using a single event?

hard📝 component behavior Q8 of 15
Angular - Component Interaction
You want to send a number from child to parent and also pass additional info. Which approach correctly sends both using a single event?
AEmit the number and call a separate method for info
BSend number via @Input and info via @Output
CUse two EventEmitters, one for number and one for info
DEmit an object like {value: number, info: string} via EventEmitter
Step-by-Step Solution
Solution:
  1. Step 1: Understand how to send multiple data in one event

    EventEmitter can emit any type, including objects with multiple properties.
  2. Step 2: Choose the approach that sends both data in one event

    Emitting an object with both number and info is clean and efficient.
  3. Final Answer:

    Emit an object like {value: number, info: string} via EventEmitter -> Option D
  4. Quick Check:

    Emit objects to send multiple data [OK]
Quick Trick: Emit an object to send multiple values in one event [OK]
Common Mistakes:
  • Trying to send multiple values separately
  • Using @Input to send data up
  • Creating multiple EventEmitters unnecessarily

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes