If you look at this question. the problem was really simple, but solutions were more complicated, to address more details I am asking this question.
If you look at stackblitz in service the code tries to build an object before passing it to a component. The problem I am having is the key value that is added by the code and it is breaking the formcontrols.
the first response returns object with routes that have only these values.
addressPointId: "adress",
municipalityId: "municipallyty",
regionId: "regionId",
settlementId: "settlementId",
rvId: "rvId", // <--- not included in second call getAddressPoint
sequenceNumber: "sequenceNumber" // <--- not included in second call getAddressPoint
the second http request takes these values and returns the it with name values, but excluding rvId and sequenceNumber.
addressPointId: "adress",
municipalityId: "municipallyty",
regionId: "regionId",
settlementId: "settlementId",
regionName: "regionName", // <--- this is added
municipalityName: "municipalityName", // <--- this is added
settlementName: "settlementName", // <--- this is added
description: "description",
I want to get the result object.
{ <-- coming from first request getRequest
"statusId": 1,
"recDate": "2019-04-18T11:05:25.827Z",
"requestVehicles": [
{
"garageId": 1,
"routes": [
{
"addressPointId": "dasdad", // <-- is in both
"municipalityId": 34, // <-- is in both
"regionId": 4, // <-- is in both
"rvId": "", // <-- coming from first request getRequest
"sequenceNumber": "", // <-- coming from first request getRequest
"settlementId": null, // <-- is in both
"regionName": "dasd", // <-- coming from second request getAddressPoint
"municipalityName": "dasdasd", // <-- coming from second request getAddressPoint
"settlementName": null, // <-- coming from second request getAddressPoint
"description": "Nadaburi" // <-- coming from second request getAddressPoint
}
],
}
],
}
(unfortunately couldn't fix stackblitz) now I am getting this on my actual project:
{ <-- coming from first request getRequest
"statusId": 1,
"recDate": "2019-04-18T11:05:25.827Z",
"requestVehicles": [
{
"garageId": 1,
"routes": [
{ // =================================
"key": { key object } // <========== this breaks the fromcontrols
//============================================================
"addressPointId": "dasdad", // <-- is in both
"municipalityId": 34, // <-- is in both
"regionId": 4, // <-- is in both
"rvId": "", // <-- coming from first request getRequest
"sequenceNumber": "", // <-- coming from first request getRequest
"settlementId": null, // <-- is in both
"regionName": "dasd", // <-- coming from second request getAddressPoint
"municipalityName": "dasdasd", // <-- coming from second request getAddressPoint
"settlementName": null, // <-- coming from second request getAddressPoint
"description": "Nadaburi" // <-- coming from second request getAddressPoint
}
],
}
],
}
the original code is coming from stackblitz.. I changed it fitting my actual scenario.
for some reason the new stackblitz isn't running, but it works fine for my actual project, other than extra key value in response.