Hello,
I have a project in Ionic 4 in which I am trying to use an SQLite database:
this.platform.ready().then(az => {
this.sqlite.create({
name: 'ionicdb.db',
location: 'default'
}).then((db: SQLiteObject) => {
db.executeSql('CREATE TABLE IF NOT EXISTS table1 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, title TEXT)').then(a=> console.log('success'));
});
});
I tried to run the code above on a device. The databased is created / opened successfully but the executeSql call throws the following error:
vendor.js:51623 ERROR Error: Uncaught (in promise): TypeError: window.angular.element is not a function
TypeError: window.angular.element is not a function
at getPromise (vendor.js:78995)
at vendor.js:79385
at cordovaInstance (vendor.js:79471)
at SQLiteObject.push../node_modules/@ionic-native/sqlite/ngx/index.js.SQLiteObject.executeSql (vendor.js:79826)
at main.js:1308
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (polyfills.js:2749)
at Object.onInvoke (vendor.js:53198)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (polyfills.js:2748)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.run (polyfills.js:2508)
at polyfills.js:3247
at resolvePromise (polyfills.js:3189)
at polyfills.js:3254
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (polyfills.js:2781)
at Object.onInvokeTask (vendor.js:53189)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (polyfills.js:2780)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (polyfills.js:2553)
at drainMicroTaskQueue (polyfills.js:2959)
Any idea why might this happen?
Thank you!