I am facing a scenario where I have a parent component that consists of multiple child components. Each child component may differ from the others, creating a diverse structure within the parent component. Here's an example:
--- Parent ---
|
Child1(component1) --- Child2(component1) --- Child3(component5) .....
My goal is to be able to retrieve messages simultaneously from all child components when a button in the parent
component is clicked. While I can successfully receive values from individual child components using EventEmitter
, I am uncertain about how to gather information from all child components at once.
Edit:
The challenge lies in dynamically creating my child components as shown below:
@ViewChild('component1Container', { read: ViewContainerRef }) component1ContainerRef: ViewContainerRef;
@ViewChild('component2Container', { read: ViewContainerRef }) component2ContainerRed: ViewContainerRef;