Is there a way to iterate my rows based on user input? For example, if the user enters 2 values, I need to display 2 rows. How can I achieve this using FormArray?
setCount(count:any){
console.log(count);
this.count = count;
this.countArray = Array(parseInt(count)).fill(0).map((x,i)=>i);
}
<mat-form-field class="full-width">
<mat-label>Qty</mat-label>
<input matInput type="number" formControlName="qty" value="0" (click)="setCount($event.target.value)">
</mat-form-field>
<tr *ngFor="let Array of Array.controls; let i = index;" [formGroupName]="i">
<td>
</td>
<td>
<input type="text" formCOntrol="Number" class="form-control" style="width:700px">
</td>
</tr>
Here is an illustration: