I couldn’t find the solution so I wrote my own (I know it’s not the best solution and might need improvements)
Implemented an interceptor that appends the time-stamp on calls which are not for assets (html/css files etc.)
myApp.factory('httpInterceptor', ['$q',function($q) {
var regex = new RegExp('\.(html|js|css)$','i');
var isAsset = function(url){
return regex.test(url);
};
return {
// optional method
'request': function(config) {
// do something on success
if(!isAsset(config.url)){ //if the call is not for an asset file
config.url+= "?ts=" + Date.now(); //append the timestamp
}
return config;
},
// optional method
'requestError': function(rejection) {
// do something on error
return $q.reject(rejection);
},
// optional method
'response': function(response) {
// do something on success
return response;
},
// optional method
'responseError': function(rejection) {
return $q.reject(rejection);
}
};
}]);
//appended the interceptor in the config block using $httpProvider
// $httpProvider.interceptors.push('httpInterceptor');