Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

ServiceWorkerModule

      
      class ServiceWorkerModule {
  static register(script: string, options: SwRegistrationOptions = {}): ModuleWithProviders<ServiceWorkerModule>
}
    

Static methods

Register the given Angular Service Worker script.

      
      static register(script: string, options: SwRegistrationOptions = {}): ModuleWithProviders<ServiceWorkerModule>
    
Parameters
script string
options SwRegistrationOptions

Optional. Default is {}.

Returns

ModuleWithProviders<ServiceWorkerModule>

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.

Providers

Provider
      
      SwPush
    
      
      SwUpdate