Dynamically remove form control in angular 2 reactive forms

Try removing the control that I am adding to the form

I tried this.*FormArray*.splice, but it does not compile. Statement that FormArray has no method splice. Then I tried removeAt(), but then when I ran the code, the error says removeAt is not a method. One compilation time fails, the next runtime fails.

I want to remove a control from an array of controls.

+4
source share
1 answer

removeAt() is a method in the FormArray namespace, but not an ES5-7 method.

(<FormArray>items).removeAt(idx)made the array become the object Typescript FormArraythat opened the methods.

0
source

Source: https://habr.com/ru/post/1680005/


All Articles