i have my FormService
title: this.fb.group({
titleList: this.fb.array([]),
name: ['', [Validators.requiredValidator()]]
}),
i add dynamic in my list with button new names
my Testing Class code
const mock = { title: {
titleList: new FormArray([]),
name: 'Movie one',
}}
formService.get().setValue(mock);
my mock have another form elements - i cut it for this part i get the error: Failed: value.forEach is not a function, TypeError: value.forEach is not a function
CodePudding user response:
const mock = { title: {
titleList: [],
name: 'Movie one',
}}
formService.get().setValue(mock);
You set a value, you don't create a new form.