Prevent image caching


#1

I’m packaging my app with cordova. When the user uploads an image it gets updated on the server but the change does not reflect on the actual device.

I have a pull to refresh setup which updates the page but the images don’t seem to update.
I have setup a cache buster which is the timestamp that is appended to the ng-src when a new image is uploaded) but it doesn’t seem to help.

 <img ng-src="{{user.profile_pic}}?cb={{random}}" ng-click="changeProfilePic()" class="profilePic">

#2

I am using the timestamp solution and it works for me.

But i get the image from the backend with the timestamp included. so i do not need to add it on my own in the template.
Maybe the ng-src does some magic.

Try to build up the timestamp url in your controller.

Good Luck.

Greets