Cannot make my app work offline


#1

I made a little app that shows a list, and it work well on my server, but I couldnt make it work locally.
I have my local files including the javascript libraries (angular, jquery and ionic of course), but when I run the app on my browser it simply doesnt work.
It throws an error on angular.js that says “414 Request-URI Too Large”.

Further more, when I try a demo locally (those in the download file), it dosnt work either locally but it does when I try it online. It just seems to fail locally.
Any help please? thanks!


#2

Hey, not sure why you’d be getting a 414, that’s strange. Can you share your code? If you include angular it should work fine…


#3

Hi,
My app is integrated with google maps,geolocation and other restful services. When I open the app in offline mode, it crashes. This was my attempt:

angular.module('storeApp', ['ionic', 'store.controllers', 'store.services',  'geolocation'])

.run(function($ionicPlatform) {



$ionicPlatform.ready(function() {
    var networkState = navigator.connection.type;
    var allowedNetworkStates = [Connection.WIFI, Connection.CELL_4G, Connection.CELL_3G, Connection.CELL_2G];
    if (allowedNetworkStates.indexOf(navigator.connection.type) === -1) {
        //offline
        alert("you need to be connected to the Internet in order to use this app");
        $ionicPlatform.exitApp();


    } else {
        //online
        //alert('online');

    }

But before it alerts offline message and exit the app the app crashes . the error message is something like google is undefined since the google maps is unavailable.

Can you please suggest a good handling in such a scenerio?