Hello, I am facing the following problem:
I have an HTML template that displays an image that constantly changes (the server from where it retrieves the image keeps a persistent connection and keeps sending new images every few seconds)
The template code looks like this:
<img src="http://server.com/getImage?rand={{rand}} />
I trap the “resume” event and inside it, I tried doing the following:
``
$scope.rand = Math.floor((Math.random() * 100000) + 1);
$state.go($state.current, {}, {
reload: true
});
In other words, I am both trying to change the URL to defeat caching as well as reloading the current state on resume
This code works when I move the app to the background and back. However, if I am viewing the image and press the screen off button and turn it back on again, the image breaks - stops showing. It seems the HTTP connection to the server is terminated and not re-connected.
To work around this, I am doing a ```$window.location.reload();``` which works but flashes the screen.
Is there a better way to reload the image without redrawing the full screen?
thx