Offline Best Practice


#1

I’m so exited joining ionic community, I was able to publish my first app using this framework.

Now I’m ready to publish my 2nd version, however I have an issue:
I have a controller that runs and $http.get statement to get a JSON file remotely, so far everything is great.

The issue is when the device is offline, I don’t want the user going to the index page until an internet connection is available.

Thanks in advance.


#2

You can make use of HTML5’s local storage.

I implemented my own version of this using factory.
Feel free to take a look at it.


#3

You need to check internet is available or not ,

Use $cordovaNetwork.isOffline()

then run statement otherwise show custom message

Read this article about how to check internet in ionic framework

http://www.codeandyou.com/2015/07/how-to-check-network-connection-in.html