Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avatar is not updated if src is removed dynamically #69

Open
andbjer opened this issue Jun 24, 2019 · 9 comments
Open

Avatar is not updated if src is removed dynamically #69

andbjer opened this issue Jun 24, 2019 · 9 comments
Labels

Comments

@andbjer
Copy link

andbjer commented Jun 24, 2019

In a project I am working on, I want to users to be able to choose their own image as avatar, and use the "initials avatar" if they don't have an image. I also want them to be able to remove an image.

When removing the image, src is updated to null. This does not update the avatar, and the image is still showing.

I have made a StackBlitz demo demonstrating my issue.

I use the following workaround right now, but I think this is something the component should be able to handle internally:

<ngx-avatar *ngIf="src; else initialsAvatar" [src]="src" [name]="name" [size]="size"></ngx-avatar>

<ng-template #initialsAvatar>
  <ngx-avatar [name]="name" [size]="size"></ngx-avatar>
</ng-template>
@BobaFett58
Copy link

+1
If I will change the user dynamically, avatar still show 'old' photo

@odahcam odahcam added the bug label Jul 23, 2019
@odahcam
Copy link
Collaborator

odahcam commented Jul 23, 2019

I can confirm this is a bug.
You forget to bind the name property in your StackBlitz example btw.

@vptcnt

This comment has been minimized.

@kamilwasyl
Copy link

Same here.

bind src={{object.src}} doesn't change the image when has a new model

@BobaFett58
Copy link

any solutions for this ??

@Adesfire
Copy link

Same issue here, this question was asked almost a year ago, not sure that's gonna be fixed someday.

@odahcam
Copy link
Collaborator

odahcam commented Apr 27, 2020

I'm not sure but maybe the current master branch already fixes this. We just don't have a publish date for it. We should test to see if it fixes the issue, otherwise make this a feature request.

@Adesfire
Copy link

Sounds good. I set a wrong string to src when I want to hide it, but that's not clean though, just a work around

@amitshinde110113
Copy link

I am facing the same issue now, but assign random string worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants