Мне нужно обновить изображение, которое я загружаю так:
<img [src]="linkPicture" alt="profile photo" width="150px" height="150px">
В файл машинописи у меня есть переменная this.linkPicture, в которой я изначально храню ссылку. Когда я обновляю картинку, не обновляйся. Я снова установил переменную ....
Вот часть моего машинописного кода
public linkPicture : string;
Установить переменную изначально
this.service.GetProfile(id).subscribe(resp => {
.....
this.linkPicture = resp.Photo;
console.log(resp); //this show the photo
});
Когда я обновляю картинку
let dialogRef = this.dialog.open(DialogUploadPhotoComponent, {
data: {
patientID: this.ss.getCurrentUserApi().PatientID
},
width : "550px",
});
dialogRef.afterClosed().subscribe(result => {
if(result != undefined){
console.log(result);
this.linkPicture = result; //I set the new picture.
}
});