如何删除Javascript缓存



我正在使用带有i18n的angularjs进行翻译。问题是我需要一种方法来制作版本,因为它每次都从缓存加载

i18n/lang-en.json

任何线索我可以做些什么来制作带有版本的 lang-xx.json,这样我就不会在这个文件中获得缓存?它们不是从任何地方加载的,但我认为它们可以在我的 configLang 中修复.js

angular.module('moduleApp.config', ['xxx.ui.commons.defaults.config.lang']);
angular.module('moduleApp.config').config(['$translateProvider', '$languageSupportProvider', function($translateProvider, $languageSupportProvider){
        // add your module specific language file to the loading chain
        // $languageSupportProvider.addLanguageFileLocation('plugins/moduleApp/i18n/moduleApp-lang-:optionsKey.json', {});
    }]
);

例如,您可以将哈希作为查询字符串添加到TranslateHttpLoader

export function HttpLoaderFactory(http: HttpClient) {
  return new TranslateHttpLoader(http, '/assets/i18n/', '.json?cb=' + new Date().getTime());
}

github问题中有外部解决方案:缓存的JSON文件

最新更新