Accessing parent, child, grandchild component variables in Angular 6

Hello all,

I have been working with Angular 6 recently and got a situation where I needed access parent, child and grandchild component variables. After a bit of digging here and there, I found the same question was aksed in SO.

I used ViewContainerRef to access parent, children and grandchildren varibales.

I created a sample StackBlitz project as part of the answer. I thought to share the SO answer and sample StackBlitz project to my website readers.

Link to SO answer :- https://stackoverflow.com/questions/41669787/how-to-change-parent-variable-from-children-component/51384602#51384602

If you have any other approaches to handle the same situation, please feel free to share your thoughts in the comments section below.

Thank you! 🙂

Share