One scenario I am facing involves the removal of a component instance from an array (located in the parent component) when a button is clicked inside the child component, based on a specific condition.
https://i.sstatic.net/YPFHx.png
Within the parent component, the 'Add BU' button is present, with three text fields below (named 'BU', 'G Value', and 'C Value') along with a close button, all of which are generated by the child component. Every time the 'Add BU' button is clicked, a new row from the child component is added to the UI. I have utilized the code below to push instances of the child component to an array in the parent component:
https://i.sstatic.net/kszYg.png
https://i.sstatic.net/glN0q.png
Now, I have two questions regarding the above setup: 1. How can I delete a specific child instance from the parent's array when the corresponding close button is clicked (which resides inside the child component)? 2. How can I retrieve the values entered in each text field (e.g. 'BU', 'G Value', and 'C Value') in each row upon clicking the 'Add' button?
Similar questions have been asked before, and I have implemented a strategy similar to the one provided in the accepted answer in this link: Add component to dom on click of button in angular2. My first question is also evident in the image below: