diff --git a/src/Umbraco.Web.UI.Client/src/app.js b/src/Umbraco.Web.UI.Client/src/app.js index 0130124e4f..4a44959b15 100644 --- a/src/Umbraco.Web.UI.Client/src/app.js +++ b/src/Umbraco.Web.UI.Client/src/app.js @@ -22,12 +22,21 @@ var packages = angular.module("umbraco.packages", []); //module is initilized. angular.module("umbraco.views", ["umbraco.viewcache"]); angular.module("umbraco.viewcache", []) - .run(function($rootScope, $templateCache) { + .run(function ($rootScope, $templateCache, localStorageService) { /** For debug mode, always clear template cache to cut down on dev frustration and chrome cache on templates */ if (Umbraco.Sys.ServerVariables.isDebuggingEnabled) { $templateCache.removeAll(); } + else { + var storedVersion = localStorageService.get("umbVersion"); + if (!storedVersion || storedVersion !== Umbraco.Sys.ServerVariables.application.cacheBuster) { + //if the stored version doesn't match our cache bust version, clear the template cache + $templateCache.removeAll(); + //store the current version + localStorageService.set("umbVersion", Umbraco.Sys.ServerVariables.application.cacheBuster); + } + } }) .config([ //This ensures that all of our angular views are cache busted, if the path starts with views/ and ends with .html, then