-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Beginning Server-Side Application Development with Angular
By :
Now that the dependency is installed, it's time to enable the service worker.
This involves three steps:
Enabling the service worker in our browser app in .angular-cli.json.
Importing and registering the ServiceWorkerModule in our AppModule.
Creating the service worker configuration file src/ngsw-config.json.
We will use the ng set command to enable support for the service worker in our browser app in .angular-cli.json:
Open the terminal in the project directory.
Run the following command to adjust .angular-cli.json:
ng set apps.0.serviceWorker=true
Confirm that the property serviceWorker is set to true in the first app in the apps array in .angular-cli.json:

We will import the ServiceWorkerModule in our AppModule and register it.
We will invoke the register method on the ServiceWorkerModule. This method takes two parameters. The first parameter defines what the location of the Angular service worker is. The value '/ngsw-worker.js' is what...
Change the font size
Change margin width
Change background colour