Cache clearing problem
archasek opened this issue · 4 comments
archasek commented
Hi.
I have this run
with cache config:
angular
.module('app.main')
.run(restangularRuns);
function restangularRuns ($cacheFactory, Restangular, apiConfig) {
var cache = $cacheFactory('http');
Restangular.setBaseUrl(apiConfig.BASE);
Restangular.setDefaultHttpFields({ cache: true });
Restangular.addResponseInterceptor(function (data, operation, what, url, response) {
if (operation === 'put' || operation === 'post' || operation === 'delete') {
cache.removeAll();
}
var extractedData = data.data;
// var extractedData = response.data;
return extractedData;
});
}
Unfortunately I think that GET cache isn't cleared properly, as after e.g. POST request I don't see any changes (after going to a specific state) until I refresh the page.
bostrom commented
I've done something similar, and I'm using
$cacheFactory.get('$http')
Does that work for you?
archasek commented
I don't think so :(