angular 2 remove all items from a formarray

后端 未结 15 1660
清歌不尽
清歌不尽 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:31

    I am very late but I found some other way where you don't need to have loops. you can reset array by setting array control to empty.

    Below code will reset your array.

    this.form.setControl('name', this.fb.array([]))

提交回复
热议问题