I have declared the below form group.
this.secondFormGroup = this._formBuilder.group({
nested: this._formBuilder.group({
arr1: [],
arr2: [],
arr3: [],
arr4: []
}),
})
Once the user fills the form, i want to loop through the arrays in the form group. But i'm getting an error that foreach is not a function. what am i doing wrong?
This is what i tried.
var arrays =this.secondFormGroup.get('nested').value
arrays.forEach(x=>{
if(x.arr1.length){
x.arr1.forEach(x=>{
console.log(arr1
})
}