2017  Kodetalk | Feedback | Privacy Policy | Terms | About

How do I cachebust and how to use in $http and html partials?

How do I cachebust/cache-buster and how to use in $http and html partials?


Basically cachebuster is a unique piece of code that prevents a browser from reusing and things that has been already seen and cached, or saved, to a temporary memory file by the browser.

To use cachebuster try below code:

myAppModule.config(function($routeProvider, $provide) {
  $provide.decorator('$http', function($delegate){
    var get = $delegate.get;
    $delegate.get = function(url, config){
      url += (url.indexOf('?') !== -1) ? '?' : '&';
      url += 'v=' + cacheBustVersion;
      return get(url, config);
    return $delegate;
Answer is