Answer the question
In order to leave comments, you need to log in
How to get data from a child component on demand of an ancestor component?
It is necessary, when a button is pressed from the ancestor component, to take JSON data, which is a field in the class of the child component, which in turn gets there through input.
What is the best way to implement this on input/output?
Answer the question
In order to leave comments, you need to log in
1) Write data to the service, and take it from there.
2) Send an event from top to bottom, and if there is data, then send an event back up, with data.
Passing through a service is not always the best way.
For example, the video component, will you call the play() and pause() commands through the service? This is done directly.
And the input element, in order to get input.value, will you also start a service for this and store links to all input components? It is in redux that data is driven in a large circle, and even then not always.
You can send an event - which is a crutch, you can make a "publication" api, there are examples on the Internet, in other frameworks it is out of the box, alight example: https://jsfiddle.net/lega911/kr1hwoj6/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question