How to use ionic cordova preferences? -
currently i'm using cordova app preferences store data today's date key.
var pref = $cordovapreferences.fetch(date, 'dates').$$state.status; if (pref===0) { var out = $cordovapreferences.store(date, '1', 'dates'); dbpopup('store' + json.stringify(out));
}
but both fetch , store methods displays status 0. didn't uninstall app every time. since uninstallation of app removes stored preferences..
i recommend using $window.localstorage
. uses keys save strings. can use json.stringify
convert objects string.
an example can found here: http://codepen.io/drewrygh/pen/ciozb
Comments
Post a Comment