Switching between Online and Offline Services in Angular – 11th Hour
While working on angular applications, sometime you want your application to work both in online and offline mode. As the name says, the online mode is, the application can connect to the network, where the offline mode is, the application can't connect to the network.
Please note that a Service Worker implementation is needed to work an application offline. Explaining a service worker is beyond the scope of this blog, so we are'nt going to discuss it over here.
Here, we're going to see the codebase of an application, which works both Online and Offline. When the application is online, the data is sent to the backend, while in the offline mode, the data is sent to Indexed DB. The application itself recognizes the working mode also.
So, before each service request is being initiated, our application recognize which mode currently the application is running in, and decide which service (Offline or Online) os being called.
Read full article from Switching between Online and Offline Services in Angular – 11th Hour
No comments:
Post a Comment