I'm learning Angular, and currently I'm trying to properly load a JSON file into my code, so I can iterate over it and show all the results. I could manage to do that, but once I changed the JSON, adding three more registries, I can't see them.
And that's because my JSON is being cached, as I could see on the network part of the developer console.
I tried changing my data serving service (which uses $q for asynchronous requests along with $http), so I can configure my $http object:
app.factory('dataService', ["$http", "$q", function($http, $q) {
return {
getAll: getAll
}
function getAll() {
var defered = $q.defer();
var promise = defered.promise;
$http({
url: "data.json",
cache: false,
method: "GET"
})
.success(function(data) {
defered.resolve(data);
})
.error(function(err) {
defered.reject(err)
});
return promise;
}
}]);
This keeps working, but didn't stop caching my JSON. I deleted my cache and executed the app again, I got the new results but once I added more registries, it kept being cached.
So, the question is... how can I avoid my JSON files to be cached?