I'm trying to get a value from my form, but I keep getting this error. This is the code. My formControlName is 'name' for the value, and I am trying to put it in a variable of type Address, a class I created. The variable is newAddress, and the form group is addressForm. Here is the function in which I am trying to implement it, and here is my Address class.
onSubmit() {
this.newAddress.name = this.addressForm.value['name'];
console.log(this.newAddress.name);
this.addressForm.reset({
name: '',
addressLine1: '',
city: '',
state: '',
zipcode: '',
});
this.addressFormDirective.resetForm();
}
export class Address {
name: string;
addressLine1: string;
city: string;
state: string;
zipcode: string;
}