Mina Fardin
Mina Fardin

Reputation: 1

calling parent component function from child of siblings component in angular

I have 2 component(comp1 and comp2) in main component that component2 has child component, I have tried to call a function in a component1 from child component of component2.

Upvotes: 0

Views: 169

Answers (1)

Tzimpo
Tzimpo

Reputation: 1009

You can read this usefull article about sharing data between Angular Components.

You can share Data via ViewChild or Output() and EventEmitter from child to parent(comp2 child to comp2) and then share these data to the sibling comp 1. But i think the best way is to use a service where you can share data on unrelated Components

Upvotes: 1

Related Questions