Code : https://stackblitz.com/edit/dynamic-child-inside-parent-component
Code description :
I have dynamically created child components while clicking on a button in the parent component.I have passed a input from parent to child component(@Input) to keep track of the button click counter value.But when i delete from the child component and add again i get the counter value wrong.I have restricted the button click to 5 times.
Example scenario : I have clicked the button 5 times so the child is rendered 5 times in case if i delete any one of the child component out of 5 (say i delete event 5 ) and click add event button from parent again i get duplicate of event 5 ?Is there a way to update the counter value in child components ? Any help would be really appreciated.Kindly see the example which i created to understand,Thanks in advance.