I am looking for a way to modify a reactive form so that it can add and delete fields to a string array dynamically. Currently, I am using a FormArray but it adds the new items as objects rather than just simple strings in the array. Here is an example of my current implementation:
ngOnInit() {
this.form = this.formBuilder.group({
user: '',
directory: '',
filenames: this.formBuilder.array([ this.createItem() ])
});
}
createItem(): FormGroup {
return this.formBuilder.group({
filename: ''
});
}