Angular 7 Service worker feature

Angular’s service worker is designed to load application in the offline mode. Similar to the native mobile app.

Using angular service worker, we could cache the application as one unit as a resource.

Few benefits of the feature:

  1. It improves the end-user experience over a slow or fluctuating network connection.
  2. It saves bandwidth when possible.
  3. We can avoid round-trip delays when loading the application.

Step1:Create new angular 7 app Use Cli command

ng new my-app-sw

“my-app-sw” is the name of my app.

Step2:add two pages page1 and page2

use cli command ng generate component page1,similarly 

ng generate component page2

Step 3:add routes for these pages /page1 and page2

 

Leave a Reply

Your email address will not be published. Required fields are marked *