Skip to content

Instantly share code, notes, and snippets.

@gmilby
Forked from ProLoser/AngularJS-Cachebusting.js
Created October 29, 2013 21:50
Show Gist options
  • Save gmilby/7223288 to your computer and use it in GitHub Desktop.
Save gmilby/7223288 to your computer and use it in GitHub Desktop.
anglar.module('myApp',['ui']).config(["$provide", function($provide) {
return $provide.decorator("$http", ["$delegate", function($delegate) {
var get = $delegate.get;
$delegate.get = function(url, config) {
// Check is to avoid breaking AngularUI ui-bootstrap-tpls.js: "template/accordion/accordion-group.html"
if (url.indexOf('template/')) {
// Append ?v=[cacheBustVersion] to url
url += (url.indexOf("?") === -1 ? "?" : "&");
url += "v=" + cacheBustVersion;
}
return get(url, config);
};
return $delegate;
}]);
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment