angular formarray remove all code example
Example 1: angular formarray remove all
const arr = new FormArray([
new FormControl(),
new FormControl()
]);
console.log(arr.length); // 2
arr.clear();
console.log(arr.length); // 0
Example 2: formarray set value at index
((this.form.get('controls') as FormArray).at(index) as FormGroup).get('description').patchValue(item.description);