Showing posts with label sqlite. Show all posts
Showing posts with label sqlite. Show all posts

Tuesday, July 26, 2016

ionic sqlite installation example

Most people had problem installing sqlite in ionic, here are the solution when you get Error:
  • Database location or iosDatabaseLocation value is now mandatory in openDatabase call
  • $window.sqlitePlugin is undefined

cordova plugin rm cordova-sqlite-storage
cordova plugin add cordova-sqlite-storage@0.7.14
 
And to make it Run under browser :

 if (window.cordova) {
            db = $cordovaSQLite.openDB({ name: "my.db" }); //device
          }else{
            db = window.openDatabase("my.db", '1', 'my', 1024 * 1024 * 100); // browser
          }