While attempting to add a string value to a formArray using material forms, I encountered the following error message:
'Argument of type 'string' is not assignable to parameter of type 'AbstractControl'.'
If I try adding a complete object to the array, it works without any issues. However, when trying to add a string value, it fails. This is where the formArray is declared:
this.maintenanceFormGroup = this._formBuilder.group({
title: '',
description: ['', Validators.required],
maintenance_images_url: this._formBuilder.array([]),
});
Here's where I attempt to push the string value(s) into the array:
const pushDownloadUrlIntoMaintenancePhotosArray = flatMap(() => {
return this._storage.downloadURL
.map(url => {
console.log(url)
const controls = <FormArray>this.formGroup.controls.maintenance_images_url;
controls.push(url);
});
});
I'm puzzled by this error - any suggestions on why it might be occurring?