Communication with grandchildren


What is the best choice to communicate with grandchildren?

For example.

I have a HomePage with footer buttons. Inside HomePage I have a component X. Inside the component X I have a component Y, which is a form product.

I wanna to action a footer button from HomePage to method of Component Y, but with that instance.
Injectable create a new component (dont works).

Would be awesome if could be:

<my-component-products #products>
button click=“products.product.add()”

– list of product –
<my-component-product-form #product>

add() {
console.log(“I’m being fired from the homepage”);

Do you understand me ? I would like to speak with the instances of my grandchildren!

Why I cannot use products.product.add() ??


I think you’re going about this backwards. Instead of trying to force activity downward, use a shared service that maintains the data model. Add things there from wherever needed, and subscribe to change in the model where those need to be represented.


Thank you!! I resolved the problem with the data in the service.