title: Service worker for caching file for faster loading
body: <p>I have one <strong>angularjs</strong> application where I have so many js and CSS files to be included. So for faster loading, I want to load it from the cache I am trying to use <strong>Service Worker</strong>.</p>
  
  <p>In <strong><code>index.html</code></strong> file, I am including js and CSS like</p>
  
  <pre><code>&lt;link href="custom.css" rel="stylesheet" /&gt;
  </code></pre>
  
  <p>and also registering service worker</p>
  
  <pre><code>&lt;script&gt;
      if ('serviceWorker' in navigator) {
          navigator.serviceWorker.register('service-worker.js', {useCache: true})
          .then(() =&gt; console.log('service worker installed'))
          .catch(err =&gt; console.log('Error', err));
      }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>But if I check in network tab of the browser it loads both through service worker and normal, so how to get it from cache completely? and also it should work on basis of versioning so that on change it gets reflected.</p>