Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ionic 3 : Can't resolve all parameters for SQLiteObject: (?)

I'm using Ionic 3 SQLite native plugin from Here(Ionicframework.com), and Here's my constructor code :

constructor(public navCtrl: NavController, 
            public menu: MenuController, 
            translate: TranslateService,
            private tts: TextToSpeech,
            private sqlite: SQLite) {

   this.sqlite.create({
      name: 'data.db',
      location: 'default'
      }).then((db: SQLiteObject) => {
        db.executeSql('create table IF NOT EXISTS `localflags`(`flag1` VARCHAR(10),`flag2` VARCHAR(10),`flag3` VARCHAR(10), `flag4` VARCHAR(10));', {})
          .then(() => console.log('Table created!!!'))
          .catch(e => console.log(e));
      }).catch(e => console.log(e));
        }

So, when I run it on device using "ionic cordova run android -lc" it give me this error,

Can't resolve all parameters for SQLiteObject: (?)

This code is from the ionic native documentation. This is very basic code, and I'm new to this, so I can't figure out what's wrong with this.

Any help will be appreciated. And if someone can point me to the Ionic 3 SQLite tutorials , that will be great. Thanks in Advance.

like image 235
PhpCoder Avatar asked Dec 23 '22 16:12

PhpCoder


1 Answers

Actually, the case was, I had Done import { SQLite, SQLiteObject } from '@ionic-native/sqlite'; this in my ts file, So I thought both SQLite and SQLiteObject are needed to imported in app.module.ts file, but after reading this answer, I removed SQLiteObject from app.module.ts file and also removed injection of SQLite from the constructor and it worked.

Hope this helps someone.

like image 134
PhpCoder Avatar answered Jan 05 '23 14:01

PhpCoder