TypeError:window.angular.element不是Ionic 4 SQLite中的函数

时间:2019-03-03 17:30:53

标签: angular sqlite ionic4 ionic-native

我在Ionic 4中有一个项目正在尝试使用SQLite数据库:

      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'));
    });
});

我试图在设备上运行以上代码。数据库已成功创建/打开,但是executeSql调用引发以下错误:

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)

任何想法为什么会发生这种情况? 谢谢!

0 个答案:

没有答案