From the course: Angular: Progressive Web Apps
Unlock the full course today
Join today to access over 24,500 courses taught by industry experts.
Update UI on network status change - Angular Tutorial
From the course: Angular: Progressive Web Apps
Update UI on network status change
- [Instructor] So now, we know that at any time, my PWA can go offline or we can directly open the PWA while offline. And it works at least the app Shell works so offline or online, we know that sometimes we can get into like a blind spot of connection and maybe the app started as online, but at one point it moved to an offline experience. So something that we can do is try to update the UI somehow to let the user know that we are offline or online. So we're going to update the UI on network status change. We can do that in any place, but I'm going to work with an app component that's the root component of my app. So at some point typically on ngOnInit, I want to know if the user is online or offline. And for that we are going to use an API available on the browsers and we will create a function for that, a method for that update network status UI. That will actually check if navigator.onLine. Be careful Capital L there…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
(Locked)
What is a service worker?8m 28s
-
(Locked)
Serving the app while offline11m 14s
-
(Locked)
Update UI on network status change6m 55s
-
(Locked)
Customizing ngsw-manifest10m 12s
-
(Locked)
Supporting app updates11m 3s
-
(Locked)
Adding web push notifications10m 10s
-
(Locked)
Validating with DevTools4m 5s
-
(Locked)
-