Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Correct usage of Ionic storage (best practise)

$
0
0

@coffeeee wrote:

Hey guys,

there is no detail into how the Ionic Storage operates.

Hence I struggle with the most efficient usage.

I am using a provider to operate on my Ionic storage collections. I have a json object with a list of movie items. I store it in a collection as a JSON, i.e. myMovieStorage.set[‘myMovieCollection’, someMovieObject.json]

Now I have a filter for categories. The user can change the filter settings via a filter menu and store the settings. The movies would then be filtered based on the category collection

How should I store and operate with the selected categories? There are two approaches:

Store the whole category as JSON in one single collection such as:
storage.set[‘mySelectedCategories’, {‘Action’ : 1, ‘Comedy’: 0, 'Thriller:: 1, etc…}]
Then I would iterate through the JSON object to filter my movieCollection

Create a seperate storage provider to store the selection as key/value pairs, such as:
storage.set[‘Action’, 1]
storage.set[‘Thriller’, 0]
storage.set[‘Comedy’, 1]

How is the storage ment to be used in my case, what is more efficient in the end?

Thanks in advance!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>