Problem Saving Data using SQLite in Ionic 2

Hi guys, I’m working on a project and i’m trying to save data in an SQLite DB but i can’t seem to figure why the data doesn’t save and considering i can’t access the sqlite features why testing the app on my browsing and there is no log on the command line console to show if there are any problems, i’m kind of stuck and any help will be appreciated.

below are the two classes where i have tried using the sqlite features.

first is the app level class

import { Component, ViewChild } from ‘[at]angular/core’;
import { Nav, Platform } from ‘ionic-angular’;
import { StatusBar, Splashscreen, SQLite } from ‘ionic-native’;

import { WelcomePage } from ‘…/pages/welcome/welcome’;
//import { TimeTablesPage } from ‘…/pages/time-tables/time-tables’;
import { CoursesPage } from ‘…/pages/courses/courses’;
import { ProjectsPage } from ‘…/pages/projects/projects’;
import { AssignmentsPage } from ‘…/pages/assignments/assignments’;
//import { NewAssPage } from ‘…/pages/new-ass/new-ass’;
//import { AssDetailPage } from ‘…/pages/ass-detail/ass-detail’;
//import { EditAssPage } from ‘…/pages/edit-ass/edit-ass’;
//import { NewProjectPage } from ‘…/pages/new-project/new-project’;

import { Page1 } from ‘…/pages/page1/page1’;
import { Page2 } from ‘…/pages/page2/page2’;

[at]Component({
templateUrl: ‘app.html’
})
export class MyApp {

public database: SQLite;
[at]ViewChild(Nav) nav: Nav;

rootPage: any = WelcomePage;

pages: Array<{title: string, component: any}>;

constructor(public platform: Platform) {
this.initializeApp();

// used for an example of ngFor and navigation
this.pages = [

  //{ title: 'Timetables', component: TimeTablesPage },
  { title: 'Courses', component: CoursesPage },
  { title: 'Projects', component: ProjectsPage },
  { title: 'Assignments', component: AssignmentsPage },
  //{ title: 'New Assignment', component: NewAssPage },

  { title: 'Page One', component: Page1 },
  { title: 'Page Two', component: Page2 }
];

}

initializeApp() {
this.platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
StatusBar.styleDefault();
Splashscreen.hide();

  //database

        let db = new SQLite();
        db.openDatabase({
            name: "data.db",
            location: "default"
        }).then(() => {
            db.executeSql("CREATE TABLE IF NOT EXISTS assignment (id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT, description TEXT )", {}).then((data) => {
                console.log("TABLE CREATED: ", data);
            }, (error) => {
                console.error("Unable to execute sql", error);
            })
        }, (error) => {
            console.error("Unable to open database", error);
        })
});

}

openPage(page) {
// Reset the content nav to have just this page
// we wouldn’t want the back button to show in this scenario
this.nav.setRoot(page.component);
}

}

then this where the data saving process should happen

import { Component } from ‘[at]angular/core’;
import { NavController, NavParams, AlertController } from ‘ionic-angular’;
import { StatusBar, Splashscreen, SQLite } from ‘ionic-native’;

/*
Generated class for the NewAss page.

See http://ionicframework.com/docs/v2/components/#navigation for more info on
Ionic pages and navigation.
*/
[at]Component({
selector: ‘page-new-ass’,
templateUrl: ‘new-ass.html’
})
export class NewAssPage {

 public database: SQLite;

  ass = {
title: '',
description: ''

};

logForm(form) {
console.log(form.value.title);
this.showAlert(form);
}

public addAss(form) {
this.database.executeSql(“INSERT INTO assignment (title, description) VALUES (form.value.title, form.value.description)”, []).then((data) => {

        console.log("INSERTED: " + JSON.stringify(data));
        this.showAlert(form);
    }, (error) => {
        console.log("ERROR: " + JSON.stringify(error.err));
    });
}

showAlert(form) {
let alert = this.alertCtrl.create({
  title: 'SUCCESS',
  subTitle: form.value.title +' saved successfully',
  buttons: ['OK']
});
alert.present();

}

constructor(public navCtrl: NavController, public navParams: NavParams, public alertCtrl: AlertController) {

this.database = new SQLite();
 this.database.openDatabase({name: "data.db", location: "default"}).then(() => {
           // this.refresh();
        }, (error) => {
            console.log("ERROR: ", error);
        });

}

ionViewDidLoad() {
console.log(‘ionViewDidLoad NewAssPage’);
}

}