This is the archived documentation for Angular v5. Please visit angular.io to see documentation for the current version of Angular.

ServiceWorkerModule

npm Package @angular/service-worker
Module import { ServiceWorkerModule } from '@angular/service-worker';
Source service-worker/src/module.ts

Overview

      
      class ServiceWorkerModule {
  static register(script: string, opts: {...}): ModuleWithProviders
}
    

Static Members

      
      static register(script: string, opts: {
    scope?: string;
    enabled?: boolean;
} = {}): ModuleWithProviders
    

Register the given Angular Service Worker script.

If enabled is set to false in the given options, the module will behave as if service workers are not supported by the browser, and the service worker will not be registered.

Annotations

      
      @NgModule({
    providers: [SwPush, SwUpdate]
})