Bird
0
0

Which of the following is the correct way to pass data from a smart component to a dumb component in Angular?

easy📝 Syntax Q12 of 15
Angular - Advanced Patterns
Which of the following is the correct way to pass data from a smart component to a dumb component in Angular?
AUse a service to directly modify dumb component variables
B<code>@Output() data: any;</code> in dumb component and bind in template
CUse <code>@ViewChild</code> to access dumb component data
D<code>@Input() data: any;</code> in dumb component and bind in template
Step-by-Step Solution
Solution:
  1. Step 1: Identify data flow direction

    Data flows from smart to dumb components via inputs.
  2. Step 2: Use Angular syntax for input binding

    Dumb components declare @Input() properties to receive data from parents.
  3. Final Answer:

    @Input() data: any; -> Option D
  4. Quick Check:

    Data to dumb = @Input() [OK]
Quick Trick: Use @Input() to pass data down from smart to dumb [OK]
Common Mistakes:
  • Using @Output() to pass data down instead of events up
  • Trying to access dumb component data directly via ViewChild
  • Modifying dumb component state via services without inputs

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes