gpt4 book ai didi

angular - 如何在不更改值的情况下更新/重新绑定(bind)变量?

转载 作者:搜寻专家 更新时间:2023-10-30 22:01:09 27 4
gpt4 key购买 nike

我有一个有多个图像的 RESTful 服务器。我正在使用以下 URL 获取用户的个人资料图片。

https://example.com/users/jake/profile_image

我的 typescript :

...
export class SomePage {

// this variable is binded to img tag in html
profile_image: string = 'https://example.com/users/jake/profile_image';

changeProfileImageInServer() {
// this method changes profile image in the server.
// But, the new image has the same URL.
}
}

变量“profile_image”的值不需要更改,因为服务器中的新图像具有相同的 URL。但我想更改 html 中的图像,因为个人资料图像已更改。从现在开始我应该做什么?

提前致谢。

最佳答案

我回答我自己的问题,认为有人会和我有同样的问题。

我也在ionic framework的论坛上传了这个问题。Ionic 框架的版主之一回答了我的问题。

this will not work because of the image cache of the browser/webview. You should store the timestamp/date, when the image was changed --> so you can add this timestamp to the image url:

'https://example.com/users/jake/profile_image?' + TIMESTAMP

来自 https://forum.ionicframework.com/t/how-can-i-update-rebind-variable-without-changing-the-value/73436/2?u=jeongmincha

关于angular - 如何在不更改值的情况下更新/重新绑定(bind)变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41178587/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com