angular 2 remove all items from a formarray

后端 未结 15 1776
清歌不尽
清歌不尽 2020-12-07 15:30

I have a form array inside a formbuilder and i am dynamically changing forms, i.e. on click load data from application 1 etc.

The issue i am having is that all the

15条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-07 16:25

    Angular v4.4 if you need to save the same reference to the instance of FormArray try this:

    purgeForm(form: FormArray) {
      while (0 !== form.length) {
        form.removeAt(0);
      }
    }
    

提交回复
热议问题