Issue
I have this object :
{
"id": 6,
"serialNumber": 555,
"status": "xxxx",
"createdDate": "2021-05-07T10:05:05.301+00:00",
"employee": {
"id": 1,
"serialNumber": 1111,
"firstName": "test10",
"lastName": "test002",
"role": {
"id": 2,
"name": "USER",
"description": "test"
},
"email": "gh@gmail.com",
"mobileNumber": "00501",
"country": "Palestine",
"password": "$2a$10$pDJA4XL92TbEXEW2hiOlvOWxVj9j1wDNxPt8ArkSyQMIAjLJM6RxC",
"name": "test10",
"enabled": true,
"deleted": false,
"credentialsNonExpired": true,
"accountNonExpired": true,
"username": "gh@gmail.com",
"authorities": null,
"accountNonLocked": true
},
"invoiceHistories": [],
"deleted": false,
"employeeId": 1
}
How can I access customer data inside this object in type script and angular? I tried to write response.employee => return object
response.employee.Id
=> not working
Any idea?
Solution
you can simply return the response object and access it via response.id
https://stackblitz.com/edit/angular-ivy-dmbhgv?file=src/app/app.component.ts
Answered By - Harsh Singla
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.