Having a set of JSON data, with 2 base IDs and attachment data within each ID. The goal is to click on a base ID and display its attachment data on a separate page. How can I retrieve information for the clicked ID only?
{
"_embedded": {
"deliveryMessageList": [
{
"id": "73c624c9-6db7-4fd2-ac91-c1084aee0565",
"attachments": [
{
"id": "fb1e6d31-4c4e-4356-be5a-827ea5ec422d",
"attachToDeliveryMessage": false
},
{
"id": "160edceb-cda7-483c-a2b9-786f583b523d",
"attachToDeliveryMessage": true
}
]
},
{
"id": "bfd600ad-754f-444d-bddb-f5cf4d7727b8",
"attachments": [
{
"id": "e4454f8c-4ecb-444e-a82a-318bbcee1c11",
"attachToDeliveryMessage": false
},
{
"id": "791a73eb-59cc-4bba-8b16-d442169a7923",
"attachToDeliveryMessage": true
}
]
}
]
}
}
Presenting the UI as shown below
https://i.sstatic.net/fbPyA.png
Attempting to implement an ID to the click event for further processing
getCustomerAccountDocs(selectedItem: any, index: number) {
this.CustomerAccountDocsService.getCustomerAccountDocs()
.subscribe((data: any) => {
this.customerAccountDocs = data;
});
}
Below is the HTML code snippet
<tr *ngFor="let item of customerAccountDocs; let i=index" (click)="getCustomerAccountDocs(item, i)">
<td> {{item.accountNumber}}</td>
<td> {{item.id}}</td>
</tr>