Bird
0
0

Which Angular decorator is commonly used to access projected content inside ngAfterContentInit?

easy📝 Conceptual Q2 of 15
Angular - Lifecycle Hooks
Which Angular decorator is commonly used to access projected content inside ngAfterContentInit?
A@ContentChild
B@ViewChild
C@Input
D@Output
Step-by-Step Solution
Solution:
  1. Step 1: Understand decorators for content access

    @ContentChild accesses elements projected into , while @ViewChild accesses view elements.
  2. Step 2: Match decorator to lifecycle hook

    ngAfterContentInit is used to act on projected content, so @ContentChild is appropriate.
  3. Final Answer:

    @ContentChild -> Option A
  4. Quick Check:

    @ContentChild accesses projected content [OK]
Quick Trick: Use @ContentChild to access projected content in ngAfterContentInit [OK]
Common Mistakes:
  • Using @ViewChild for projected content
  • Confusing @Input with content querying
  • Trying to use @Output for content access

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes