Issue
In the screenshot showing list of applications created
function to get list of apps -> ts file
getcmsApps() {
this.getCmsService.getApps().subscribe((res: any) => {
this.data = res;
console.log(res)
})
}
editAppById(appid: string): void {
}
deleteAppId(appid: string){
}
Solution
The response you get is an object array. So you can just loop trough the array and access the field by its key name
let AngularResponse = [
{
createdon: "4/1/2022",
division: "test",
email: "aaaa@gmail.com",
fax: "1",
hrbinformation: "1",
id: "d7ab1fc0-0e33-4fb7-ac71-1bf48ddd8bf8"
},
{
createdon: "6/2/2022",
division: "test",
email: "bbbbbb@gmail.com",
fax: "2",
hrbinformation: "2",
id: "a869fdd8-bf99-49d9-bb72-7bb11e6fadbf"
},
]
console.log(AngularResponse[0].id);
//OR to get all of them
AngularResponse.forEach(arrayItem => console.log(arrayItem.id))
Answered By - thijmende1
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.