I'm using AngularJS v1.2.7 with Cordova 3.3.0 (Android) I need to store some settings in the phone memory- so when the app/device restarts, the app can still have access to this stored data.
Any tutorials about this? I couldn't find any :(
Knowing that Cordova supports; LocalStorage, WebSQL (no more maintained), IndexedDB (not widely supported by Opera and Safari). I tend to use LocalStorage but does it keep/remember the data even after I restart the device?
At the moment I'm using the answer #12969480 by Richard Szalay .
I was looking around for something similar for the hell of it. I found the following:
http://ngmodules.org/modules/angularLocalStorage
Example has a text box showing the saved state: http://plnkr.co/edit/Y1mrNVRkInCItqvZXtto?p=preview
var eS = angular.module('exampleStore', ['localStorage']);
eS.controller('MainCtrl',['$scope','$store',function($scope, $store) {
$store.bind($scope, 'propertyOnScope', 'My default value');
$scope.clearTest = function(){
$store.remove('propertyOnScope');
};
}]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With