I am making an rest api to a java backend with angular. When making the call it returns an array of Users. These users also have an array of certifications as well. When I console.log() one of the users to test it, it shows the array of certifications in json within the inspect of chrome. When I try to log just 1 of the certifications it doesn't show. It also does not show on the page either. Could this possibly be because of some kind of lazy loading?
This code snippet shows an empty array of certifications in chrome
loadUsers() {
this.userServ.getUsers().subscribe(
(users) => {
this.users = users;
this.viewUsers = this.users.map((x) => x);
console.log(this.viewUsers[0].certifications);
},
(noUsers) => {
console.log('Error gettings users from service');
console.log(noUsers);
}
);
}
While this code snippet will show both certifications attached to viewUsers[0] once expanded in the chrome inspect.
loadUsers() {
this.userServ.getUsers().subscribe(
(users) => {
this.users = users;
this.viewUsers = this.users.map((x) => x);
console.log(this.viewUsers[0]);
},
(noUsers) => {
console.log('Error gettings users from service');
console.log(noUsers);
}
);
}