I am trying to get the nested object to display in the template with a get request. The issue is it display the main properties of my object, though, the nested object.
export class User {
userId: number;
userName: string;
password: string;
firstName: string;
lastName: string;
role: number;
inforamation: Information;
}
This is my model which can show user properties but not information.
getAllUsers(){
const header = new HttpHeaders({
'Content-Type': 'application/json'
});
return this.usersapiservice.getData(this.REST_API_SERVER, {headers : header});
}
ngOnInit(){
this.getAllUsers().subscribe((data: User[]) => {
this.users = data;
});
}
In my html
{{users.firstname}} // work
{{users.information.adress}} // Does not work
console.log(this.users)after the linethis.users = data;and please check how the object looks like in the console