ocLazyLoad icon indicating copy to clipboard operation
ocLazyLoad copied to clipboard

Add cacheBuster option

Open zhouzi opened this issue 8 years ago • 4 comments

This PRs moves the cacheBuster function to a configurable option. That way you can manage how the urls are generated and thus the cache invalidated, e.g:

angular
  .module('app', [
    'oc.lazyLoad',
  ])
  .config([
    '$ocLazyLoadProvider',
    function ($ocLazyLoadProvider) {
      $ocLazyLoadProvider.config({
        cacheBuster: function (url) {
          // this is just an example and will not work for urls
          // that already have query parameters
          return url + '?_cache=' + window.assetsVersion;
        }
      });
    }
  ]);

Related to #306

Note: the cacheBuster is used only when the cache option is set to false, which is a per file option. If you want to set cache to false for every modules, have at look at #335

zhouzi avatar Aug 03 '16 13:08 zhouzi

Historically, some loaders weren't using the cacheBuster so I am adding them one by one as I'm needing them. Let me know if I've missed one that's useful to you.

zhouzi avatar Aug 03 '16 13:08 zhouzi

When change is merge with master branch? I really need it.

luismatesanz avatar Aug 31 '16 06:08 luismatesanz

@luismatesanz I am afraid this PR is not going to be merged any time soon. If you really need it, you can install this fork via: npm install wizbii/ocLazyLoad#merge

zhouzi avatar Aug 31 '16 08:08 zhouzi

Up! :D

We need it.

ronaldohoch avatar May 23 '17 18:05 ronaldohoch