form array api data code example
Example 1: angular formarray remove all
const arr = new FormArray([
new FormControl(),
new FormControl()
]);
console.log(arr.length);
arr.clear();
console.log(arr.length);
Example 2: ionic 5 formarray
<div formArrayName="items"
*ngFor="let item of orderForm.get('items').controls; let i = index;">
<div [formGroupName]="i">
<input formControlName="name" placeholder="Item name">
<input formControlName="description" placeholder="Item description">
<input formControlName="price" placeholder="Item price">
</div>
Chosen name: {{ orderForm.controls.items.controls[i].controls.name.value }}
</div>