Kishor
Kishor

Reputation: 23

Remove image from cache in ionic app

I'm creating an Android app with Ionic and in controller.js file, I'm showing image from URL. It shows very well, but if I change the image on server, in app old image is displayed. How can I make sure that updated, new image is shown in app? Following is the code -

document.getElementById("news1Img").src="http://someserver.com/folder/news1Img.png";

How can I clear cache in that view? (Pls note - I've already added cache-view="false") Thanks in advance.

Upvotes: 0

Views: 2867

Answers (2)

raj peer
raj peer

Reputation: 728

Please try this one, I hope it will work

document.getElementById("news1Img").src="http://someserver.com/folder/news1Img.png?time=12322";

Upvotes: 1

Sharad Kale
Sharad Kale

Reputation: 971

You can disable cache this way from app.js

.config(function ($ionicConfigProvider) {
    $ionicConfigProvider.views.maxCache(0);
})

Upvotes: 0

Related Questions