Dwight Matthys
Dwight Matthys

Reputation: 143

How to refresh an image in knockoutjs

Hej guys,

After fetching a "new url" in my backend, I want to refresh the image by setting the property on my viewmodel, which is bound to the src attribute of the image.

Problem is that the url is not realy changed since I always overwrite the image in the backend.

Any ideas?

Upvotes: 2

Views: 499

Answers (1)

Dwight Matthys
Dwight Matthys

Reputation: 143

Hej guys,

Seems I didn't look far enough, seems like my brain is half a sleep, ha!

Added a cache breaker to the url:

self.someUrl(data.url + "?" + new Date().getTime());

See Refresh image with a new one at the same url

Upvotes: 3

Related Questions