I am encountering an issue with calling the post service in my TypeScript code. My scenario involves receiving user input through a form, storing this data in an array, and displaying it in a table. Subsequently, when I attempt to save the data by clicking a button that triggers a service call, the service fails without any visible error message. Interestingly, I have additional services being called on the same button click which are functioning correctly, but the service for handling arrays is not working as expected.
Service.ts
insertAddresses(formData: SettingsAddressesModel) {
return this.http.post(this.apiURL + "/SettingAddress/SaveAddress", formData);
}
Component.ts
insertAddressList(compIDforAddress){
for(var i = 0; i < this.childSettingAddressComponent.SettingsAddressesList.length; i++){
this.childSettingAddressComponent.SettingsAddressesList[i].ElementID = compIDforAddress;
//this.addressService.insertAddresses(this.childSettingAddressComponent.SettingsAddressesList[i]);
console.log('address data', this.childSettingAddressComponent.SettingsAddressesList[i]);
}
this.addressService.insertAddressListArray(this.childSettingAddressComponent.SettingsAddressesList);
console.log('Address Elment ID:', compIDforAddress);
}