Situation:
The example below shows a file named contacts
in JSON format:
[
{
"name": "Ailis Wyld",
"addresses": [
{
"addressType": "Business",
"city": "Lansing",
"postalCode": "48930"
},
{
"addressType": "Home",
"city": "Young America",
"postalCode": "55573"
}
]
},
{
"name": "Aksel",
"addresses": [
{
"addressType": "Business",
"city": "Battle Creek",
"postalCode": "49018"
},
{
"addressType": "Home",
"city": "Memphis",
"postalCode": "38131"
}
]
},
{
"name": "Dearan",
"addresses": [
{
"addressType": "Other",
"city": "Minneapolis",
"postalCode": "55417"
},
{
"addressType": "Other",
"city": "Sacramento",
"postalCode": "95833"
}
]
}
]
I have a display for the name
and address
of each contact, like shown here:
https://i.sstatic.net/oL1Ks.png
Desired Outcome:
- For multiple addresses displayed, clicking on a specific address (e.g., addressType: Home) should allow me to edit that address by showing its values (addressType, city, postalCode) in input fields as depicted here: https://i.sstatic.net/Tt4S2.png
This would enable me to make edits and update that particular address.
- Additionally, I should be able to add a new address using those input fields.
Here is a link to my stackblitz DEMO