Hello,
i want to use SQLite, this is my code:
import { Component } from '@angular/core';
import { SQLite } from 'ionic-native';
import { NavController } from 'ionic-angular';
@Component({
selector: 'page-page1',
templateUrl: 'page1.html'
})
export class Page1 {
constructor(public navCtrl: NavController) {
let db = new SQLite();
db.openDatabase({
name: 'data.db',
location: 'default'
}).then(() => {
db.executeSql('CREATE TABLE IF NOT EXISTS medis(id INT PRIMARY KEY, wirk TEXT)', {}).then(() => {
}, (err) => {
console.error('Unable to execute sql: ', err);
});
}, (err) => {
console.error('Unable to open database: ', err);
});
}
}
when I run it on my Android Phone, I get the error:
11-12 03:44:14.117: I/chromium(10741): [INFO:CONSOLE(11)] "Unable to open database: ", source: file:///android_asset/www/build/main.js (11)
Have I create the database befor, and when I have to do, how?