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
You can easily define a getter for your array and clear it as follows:
formGroup: FormGroup
constructor(private fb: FormBuilder) { }
ngOnInit() {
this.formGroup = this.fb.group({
sliders: this.fb.array([])
})
}
get sliderForms() {
return this.formGroup.get('sliders') as FormArray
}
clearAll() {
this.formGroup.reset()
this.sliderForms.clear()
}