Ionic 2 sqlstorage get function return array

314 Views Asked by At

im wondering if there is a way to get the reponse of that following code in an array?

this.storage.get('name').then((value) => { return JSON.parse(value); });

im only getting it in a reponse type and can only see my data in zone_symbol__value but i want it in an array how to do it? enter image description here

here is my code

this.database.executeSql("SELECT * FROM PharmacieGarde where groupe = ?", [this.GRP])
  .then((data) => {
    this.gardelist = [];
    if(data.rows.length > 0) {
      for (var i = 0; i < data.rows.length; i++) {
        this.gardelist.push({
          nom: data.rows.item(i).nom,
          quartier: data.rows.item(i).quartier
        });
      }
      this.storage.set('name111', JSON.stringify(this.gardelist));
      this.loader1.dismiss();
    }
  }

the data reading function

console.log("ghghgh", this.storage.get('name111').then((value) => {
  return JSON.parse(value);
}));

My code is working but instead of a promise type response , i just want the response in an array

0

There are 0 best solutions below