Outline

In the last video, we learned how to add a FormControl to a FormArray. Now we’ll learn how to remove them.

First, we'll add a new method called removePhoneNumber(), which takes a parameter of index so that we can specify which formControl we’re removing from the array. We'll then use the FormArray method removeAt(), passing the index. removePhoneNumber(index: number): void { this.phoneNumbers.removeAt(index); }

In the template, add a click event on the remove_button on line 15, passing in the index i we defined in the *ngFor:
(click)="removePhoneNumber(i)"

 

I finished! On to the next chapter