In the previous post, we added basic offline support to a weather app by storing data locally with SQLStorage. However, even this can fail. There are times where we may not be able to retrieve data from the database or from the network. In this post, we’ll be solving this problem by creating a friendly alert that gives the user the option to open their network settings.
Here’s what it will look like:
This will be created by combining the alert component with the Ionic Native Diagnostic plugin. We will also be creating a reusable service that wraps Angular’s HTTP module. This service will display our alert whenever an HTTP request is made and there is no internet connection available. Let’s get started!