Answer the question
In order to leave comments, you need to log in
How to pass value from child to parent?
I'm trying to make a relationship 1.child - 2.parent - 3.child.
Two children are inherited from 1 parent, but the data must be transferred first from one child to the parent, and then from the parent to the child, because the children are not related to each other.
I manage to make a connection from parent to child, there I use @Input():
@Input() isSearch: boolean = false;
in the parent I receive it and give it like this
The question is how can I pass this headerSearch value to the parent from another child?
I hope I wrote clearly. As I understand it, there is @Output () - but it is in order to listen to events, and when loading, I just need to pass a boolean value
Answer the question
In order to leave comments, you need to log in
You can do it through the service. A service instance is created in which the value is stored. One child is connected to services using data-binding, the second one requests via a method.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question