Inside this ngFor:
<ion-card *ngFor="let review of reviews">
<ion-card-content>
{{getUserName(review.user_ID)}}
</ion-card-content>
</ion-card>
I need to show the username, but to get user name i need to call user service to get the username. The problem is when i try like this. The page keep loading and loading. What is the correctly way to call service inside ngFor?
This is my getUserName method:
getUserName(userId)
{
this.userService.loadUserById(userId)
.then(dataUser => {
this.user = dataUser;
});
return this.user;
}
And when i get the object how to access the object property like in html? (Example: user.firstName). Thanks…