2

I am using Angular 5 with service worker for one of my application. Service worker is working fine as expected but I am not able to use SwUpdate functionality of service worker. I am using below code in my app component to check for update-

import { SwUpdate } from '@angular/service-worker';

export class AppComponent implements OnInit {
  constructor(private swUpdate: SwUpdate) { }
  ngOninit() {
    this.swUpdate.available.subscribe(event => {
      console.log('A newer version is now available. Refresh the page now to update the cache');
    });
    this.swUpdate.checkForUpdate()
  }
}

When I am checking my application on server, it always gives error as below - enter image description here

Raj
  • 264
  • 1
  • 3
  • 18

0 Answers0