Is there a simple method to patch an Angular form using auto mapper? I am looking to transfer member names from a class directly into the form without having to manually write out each one. This is especially important as my company has many forms and I want to follow the DRY principle to avoid repetitive coding, etc.
this.editAddressForm.patchValue({
'streetNumber': this.addressMailingData.streetNumber,
'predirectional': this.addressMailingData.predirectional,
'streetName': this.addressMailingData.streetName,
'streetType': this.addressMailingData.streetType,
'postdirectional': this.addressMailingData.postdirectional,
'city': this.addressMailingData.city,
'state': this.addressMailingData.state,
'postalCode': this.addressMailingData.postalCode
Possible Solution: When attempting to do this by simply passing in the entire addressMailingData object like below, an error occurs:
this.editAddressForm.patchValue(this.addressMailingData);
Error: Argument of type 'string' is not assignable to parameter of type '{ [key: string]: any; }'