ionic 2 storage forEach example

ionic 2 storage forEach example
ionic 2 storage forEach example

ionic 2 storage forEach example. Looking for ionic 2 ‘@ionic/storage’ forEach(iteratorCallback) example. Check get all stored keys forEach method use by example.

ionic 2 storage

Storage is an easy way to store key/value pairs and JSON objects. Storage uses a variety of storage engines underneath, picking the best one available depending on the platform.

When running in a native app context, Storage will prioritize using SQLite, as it’s one of the most stable and widely used file-based databases, and avoids some of the pitfalls of things like localstorage and IndexedDB, such as the OS deciding to clear out such data in low disk-space situations.

When running in the web or as a Progressive Web App, Storage will attempt to use IndexedDB, WebSQL, and localstorage, in that order.

You will find ionic 2 storage usage detail here.

ionic 2 storage forEach(iteratorCallback)

Iterate through each key,value pair.
Param = iteratorCallback (a callback of the form (value, key, iterationNumber))

ionic 2 storage forEach usage Example

In my case, I stored 4-5 entry using ionic 2 storage. After that when time comes to use it, i check for available method and forEach found in documentation. Here issue is, no example given for it.

After some efforts found ionic 2 storage forEach example.

import { Storage } from '@ionic/storage';

constructor(private storage:Storage) {}

//ionic 2 storage forEach usage => { (value, key, index) => {