ios - Unable to open database ReferenceError: sqlitePlugin is not defined -


i developing ios app in angular2 , ionic2.

i have system information :

enter image description here

my product.ts file code is:

import { component} '@angular/core'; import {navcontroller, navparams, modal} 'ionic-angular'; import {platform, ionicbootstrap} 'ionic-angular'; import {statusbar, sqlite} 'ionic-native';  @component({   templateurl: 'build/pages/product/product.html', })  export class productpage {   public database: sqlite;   public peoples: array<object>;    constructor(public platform: platform)    {     //this.createsqlitedb();     //this.opendb();     //this.adddb();     //this.refreshdb();     //this.showdbvalue();   }    createsqlitedb()   {     console.log("createsqlitedb called.");      let db = new sqlite();     db.opendatabase({         name: "data.db",         location: "default"         }).then(() => {           db.executesql("create table if not exists people (id integer primary key autoincrement, firstname text, lastname text)", {}).then((data) => {           console.log("table created: ", data);           }, (error) => {             console.error("unable execute sql", error);           })           }, (error) => {             console.error("unable open database", error);       });        }    opendb()   {     console.log("opendb called.");      this.database = new sqlite();     this.database.opendatabase({name: "data.db", location: "default"}).then(() => {       this.refreshdb();     }, (error) => {       console.log("opendb error: ", error);     });   }    public adddb()    {     console.log("adddb called.");      this.database.executesql("insert people (firstname, lastname) values ('nic', 'raboy')", []).then((data) => {             console.log("inserted: " + json.stringify(data));         }, (error) => {             console.log("adddb error: " + json.stringify(error.err));         });     }    public refreshdb()    {     console.log("refreshdb called.");      this.database.executesql("select * people", []).then((data) => {             this.people = [];             if(data.rows.length > 0) {                 for(var = 0; < data.rows.length; i++) {                     this.people.push({firstname: data.rows.item(i).firstname, lastname: data.rows.item(i).lastname});                 }             }         }, (error) => {             console.log("refreshdb error: " + json.stringify(error));         });   }    showdbvalue()   {     console.log("showdbvalue called.");      this.database = new sqlite();         this.database.opendatabase({name: "data.db", location: "default"}).then(() => {             this.refreshdb();         }, (error) => {             console.log("error: ", error);         });   }    getdata()   {     console.log("getdata called.");      //this.database = new sqlite();     //console.log("this.database obj: ",this.database);      this.createsqlitedb();     //this.opendb();     //this.adddb();     //this.refreshdb();     //this.showdbvalue();   } } 

i have use sqlite database in app local storage applied this code , run app show error : enter image description here


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -