What is the best way to store data?

Just want to clarify…
What is the best solution to store some data? I mean any db-access-layers? LocalStorage?
Data size: from 10 KB to 100MB
Data type: json object

This isn’t really an Ionic question, more of a general application architecture question.

What do you intend to do with the data? Do you need it stored centrally (ie. On a server) or do you want it to persist locally on the device?

Maybe give us some more background and we’ll be able to offer better advice / opinions :smile:

Yep, sure.
I want to retrieve data from some server and store it locally…

Okay well retrieving data from a server you’ll do using an Angular service or factory, I have an example showing how that can be done… Examples are plentiful on the web though as this is standard AngularJS functionality (not specific to Angular).

Here is my example showing the use of a factory:

The Ionic team also have a tutorial on use of services:


For local storage, there is a great Angular tutorial here:


That will walk you through the storing and retrieval of the local data.

Good luck :smile:

1 Like

It is a question of what data and how long the data should be stored :wink:

Data like login and so on, you will need a database.
If you online want to store data for a session -> localstorage/cookies/sessions