ensures that the template cache is cleared on startup if it hasn't been tracked in local storage
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user