Reference error: Cannot read property 'executesql' of undefined in ionic


#1

i want to save a json data (from url) into sqlite. the json data is just a example before i use a real data. i am using ionic 3 and typescripts language. i do some research and try most of the tutorial to solve this problem but it still cannot solve. hopefully u can help me to solve the problem. Thank you. here is my code.
this is a network-engine.ts


this is  **home.ts**


import { Component } from ‘@angular/core’;
import { NavController } from ‘ionic-angular’;
import { HttpClient } from ‘@angular/common/http’;
import { NetworkEngineProvider } from ‘…/…/providers/network-engine/network-engine’;
import { Platform } from ‘ionic-angular’;

@Component({
selector: ‘page-home’,
templateUrl: ‘home.html’
})
export class HomePage {

constructor(public navCtrl: NavController, public network: NetworkEngineProvider, public http:HttpClient, private platform: Platform) {

}

getServerData()
{

  let url = "https://jsonplaceholder.typicode.com/posts";
  
  let serverResponse : Promise <any>;
  serverResponse = this.network.callServer(url);
  serverResponse.then(data => {
	  console.log("Save" + JSON.stringify(data));
  }).catch(err => {
  console.log("Error " + err);
  })

}

loadSaveData()
{

  let dataResponse : Promise <any>;
  dataResponse = this.network.displayData();
  dataResponse.then(data => {
	  this.developer = data;
  })

}

}


this is home.html
Json Parsing Basics and save Json Get Data From Server Load Data {{dev.id}}

#2

Your error message says “cannot read property ‘executesql’ of undefined”. Therefore the problem must lie somewhere where you are trying to access a property (presumably by calling a method) called “executesql”, and the object which you are trying to invoke it on is undefined. I do not see the string “executesql” anywhere in the code you have posted, so the problem must lie elsewhere.