Angular : 4.1.0
I have a component HTML like this:
<div class="valign-wrapper" style="margin-bottom: 8px;font-size: 15px">
<img [src]="((**getProfilePhoto(item.userId)** | async)?.profilepicUrl)" class="responsive-img circle" style="height: 40px; width: 40px; margin-right: 10px" onerror="this.onerror=null;this.src='../assets/user.png';">
<span style="font-family: 'Nunito', sans-serif">{{item.author}}</span> </div>
Now the corresponding function for getting the image is like this:
getProfilePhoto(userID){
this.users = this.db.object('/social/user/'+userID+'/');
return this.users;
}
The image loads correctly. but the function getProfilePhoto(userID)
keeps on running indefinitely; even after the image is loaded the functions keeps running so the web page freezes after some time.