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:
- It improves the end-user experience over a slow or fluctuating network connection.
- It saves bandwidth when possible.
- 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