How to use Sqlite with ionic 2 rc.0?

前端 未结 3 2197
猫巷女王i
猫巷女王i 2020-12-03 16:14

I would like to know how to use Sqlite with Ionic 2 rc.o release.I am finding it difficult as there are no examples for the latest version release and i am stuck.Nothing on

3条回答
  •  粉色の甜心
    2020-12-03 16:49

    On ionic-storage repo they say to use Ionic Native SQLite plugin. So like this:

    import { SQLite } from 'ionic-native';
    
    SQLite.openDatabase({
      name: 'data.db',
      location: 'default'
    })
      .then((db: SQLite) => {
    
        db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {}).catch(() => {});
    
      })
      .catch(error => console.error('Error opening database', error));
    

提交回复
热议问题