Hallo
I wrote an Ionic1.x app which retrieve and display a remote JSON via $http.get
On the server, a new JSON gets published whenever backend data changes, so that the app can fetch directly a JSON rather than a webservice endpoint.
The app fetches a new JSON whenever the user enters a specific view (for the moment: I’m goin to implement a more reliable caching after tests).
The service definition:
app.service('HttpService', function($http, ApiEndpoint) { return { all: function() { return $http.get( ApiEndpoint.url + '/json/full.json') .then(function(response) { return response.data; }); } } });
In the controller:
app.controller('ProductsCtrl', function($scope, HttpService) { HttpService.all() .then(function(response) { $scope.products=response.products; }); })
It runs OK on emulators and some real devices (tried some Android 5.0.6, 6.x, 4.1.2, 4.4.2, iOS 9.3).
On an LG G3 running “Android 5.0”, the JSON doesn’t update until I clear app data from Android’ App Management.
Why the JSON gets cached? How could I prevent this?
Thanks in advance