0

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.

1
  • 1
    You need to reformulate your question. Show us the code you have written, so maybe we can understand what you are trying to do. Commented Apr 23, 2020 at 20:35

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you for your answer, but I want to call a function between siblings component not sharing data between them.
@MinaFardin like sharing data you can use eventEmitter to call function from sibling component
I could not call directly function between child component and sibling component. and because of that first of all I have tried to call parent function of child component then have called function of main component and finally I could access to child function of main component. This will be clearer by drawing the shape but I could not share it.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.