Local reference variables @viewchild() and @contentchild() in angular
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Vishal JoshiRank #377 · 6.7K reputationPosted Oct 20, 2022, 9:05 AM EDT
@Viewchild
The Child Element which is located inside the component template
@Contentchild
Any element or component projected inside becomes a ContentChild. If you want to access and communicate with ChildComponent projected inside ParentComponent, you need to read it as ContnetChild.
ViewChild and ContentChild are two very important features of Angular. It is used to access Child Component in the Parent Component.
Brahma Prakash ShuklaRank #633 · 3.8K reputationPosted Nov 6, 2022, 2:09 AM EST
https://www.infragistics.com/community/blogs/b/infragistics/posts/simplifying-viewchild-nad-contentchild-in-angular