Reader small image

You're reading from  Angular Projects - Third Edition

Product typeBook
Published inJul 2023
Reading LevelIntermediate
PublisherPackt
ISBN-139781803239118
Edition3rd Edition
Languages
Tools
Right arrow
Author (1)
Aristeidis Bampakos
Aristeidis Bampakos
author image
Aristeidis Bampakos

Aristeidis Bampakos is a Web Development Team Lead at Plex-Earth who specializes in the development of web applications with Angular. He has been an Angular Google Developer Expert (GDE) since 2020 and works as an Angular Senior Tech Instructor at Code.Hub, a private educational institute, where he nurtures aspiring Angular developers and professionals. He is also the author of Angular Projects with Packt.
Read more about Aristeidis Bampakos

Right arrow

Enabling offline mode with the service worker

Users from anywhere can now access our Angular application to get weather information for any city they are interested in. When we say anywhere, we mean any network type, such as broadband, cellular (3G/4G/5G), and Wi-Fi. Consider the case where a user is in a place with low coverage or frequent network outages. How is our application going to behave? Let’s find out by experimenting:

  1. Run the Angular application using the ng serve command of the Angular CLI.
  2. Open your favorite browser and navigate to http://localhost:4200, the default address and port number for an Angular CLI project. You should see the input field for entering the name of the city:
Εικόνα που περιέχει κείμενο  Περιγραφή που δημιουργήθηκε αυτόματα

Figure 4.3 – Entering the name of a city

  1. Open the developer tools of your browser and navigate to the Network tab. Set the value of the Throttling dropdown to Offline:
Figure 4.3 – Offline network mode

Figure 4.4 – Offline network mode

  1. Try...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Angular Projects - Third Edition
Published in: Jul 2023Publisher: PacktISBN-13: 9781803239118

Author (1)

author image
Aristeidis Bampakos

Aristeidis Bampakos is a Web Development Team Lead at Plex-Earth who specializes in the development of web applications with Angular. He has been an Angular Google Developer Expert (GDE) since 2020 and works as an Angular Senior Tech Instructor at Code.Hub, a private educational institute, where he nurtures aspiring Angular developers and professionals. He is also the author of Angular Projects with Packt.
Read more about Aristeidis Bampakos