角度函数继续运行

时间:2017-05-06 12:15:39

标签: javascript angular angularfire2

Angular:4.1.0

我有一个像这样的组件HTML:

<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>

现在获取图像的相应功能如下:

getProfilePhoto(userID){
    this.users = this.db.object('/social/user/'+userID+'/');
    return this.users;
}

图像正确加载。但是函数getProfilePhoto(userID)无限期地继续运行;即使在加载图像后,功能也会继续运行,因此网页会在一段时间后冻结。

0 个答案:

没有答案
相关问题