Search code examples
angularjscordovaionic-frameworkphonegap-plugins

What is the simplest persistent storage in Ionic v1


I have a very trivial Ionic v1 app that needs to store a persistent single string. What are my options, local file, sql? I have tried local storage and it is too unstable, I loose what is stored if the app is force quit.

I am currently using the Ionic Settings plugin with the app settings plugin, but have not had very good results retaining the stored value.


Solution

  • This Link will help you decide which storage to use.

    you have these options

    • LocalStorage
    • WebSQL
    • IndexedDB

    if you want to store just a string you should use localStorage it is simple and easy.

    //set item
    window.localStorage['key'] = "value";
    //get Item
    var value = window.localStorage['key'];
    

    explore more storeage options and its advantages here.