Search code examples
javascriptcordovaionic-frameworkcordova-plugins

Ionic Cordova ngstorage error


I am quite new in Ionic Cordova IOS and Android development. I have some problems with my application. My first question by default where is location (in Mac) of the log files in Cordova IoS and Android applications? Secondly I use ngstorage in my application. I have an array where I must push my data to that array. Each time after the quitting my application, when I try to access to that array I got an error that Push method is not a function. However after the cleaning the storage from browser everything become the normal. The same things repeated every time when I push new element to the array. But it shows me that new element in list. Below is my storage code. But I think there is no strange something here:

.factory('$localStorage',['$window', function ($window) {
        return {
          store: function(key, value) {
            $window.localStorage[key] = value;
          },
          get: function (key, defaultValue) {
            return $window.localStorage[key] || defaultValue;
          },
          storeObject: function (key, value) {
            $window.localStorage[key] = JSON.stringify(value);
          },
          getObject: function (key, defaultValue) {
            return JSON.parse($window.localStorage[key] || defaultValue)
          }
        }

Also here is my second question which is part of this application for push method: Ionic application error: array.push() is not a function


Solution

  • localStorage and sessionStorage done right for AngularJS. Github