Reputation: 1255
I am using oclazyload in my angular app, also I am setting version in my app. So whenever version number changes I need to clear the cache. is there any method to implement that?
angular.module('app')
.run(['$rootScope',function ($rootScope) {
$rootScope.appVersion = 1.5;
}])
.config(['$ocLazyLoadProvider', function($ocLazyLoadProvider) {
$ocLazyLoadProvider.config({
debug: false,
events: true,
modules: [{
name: 'isotope',
files: [
'assets/plugins/imagesloaded/imagesloaded.pkgd.min.js',
'assets/plugins/jquery-isotope/isotope.pkgd.min.js'
]
}
]
});
}]);
Upvotes: 0
Views: 1447
Reputation: 43
You can add the files with the version timestamp like this:
files: [{ type: 'js', path: 'assets/plugins/imagesloaded/imagesloaded.pkgd.min.js?v=' + version }]
Upvotes: 1
Reputation: 833
you could use 'cache' parameter. The parameter cache: false works for all native loaders (all requests are cached by default by the browser). If you use it, the loaders will append a timestamp to the url in order to bypass the browser cache:
$ocLazyLoad.load({
cache: false,
files: ['testModule.js','bower_components/bootstrap/dist/js/bootstrap.js']
});
reference : angular ocLazyLoad
Upvotes: 0