作者热门文章
- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我有一个有多个图像的 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
关于angular - 如何在不更改值的情况下更新/重新绑定(bind)变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41178587/
我是一名优秀的程序员,十分优秀!