I'm trying to create a component several times on a button click. The button is in the parent component and when the click "Add more" it will create the child component as many times as they click "Add more". By default there's only one child component showing then when we click on the button the same child component will be added after the existing one.
how to create existing child component multiple times on button click?
Should I use component Factory or just a plain forLoop?
HTML -Child component
<input type="text />
HTML -Parent component
<child-component #childCom></child-component>
<button (click)="addMore()">Add more</button>
TS
@ViewChild('childCom') childCom: ElementRef;
addMore(){
console.log("child component");
}
*ngFor: angular.io/tutorial/toh-pt2