0

I want to work with sqlite with cordova framework for the first time. As I've read on a tutorial I should use ngcordova like this:

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

        $cordovaSQLite.execute(db, "CREATE TABLE IF NOT EXISTS mobileContact (id integer primary key, name text, mobile text,exit integer)");

but facing issue while deployment

Uncaught TypeError: Cannot read property 'openDatabase' of undefined ng-cordova.min.js (9,20659)
Hassan Abbas
  • 467
  • 2
  • 8
  • 28

1 Answers1

0

Edit :

specifying the location solve the problem :

db = $cordovaSQLite.openDB({ name: "DBname.db" ,location:'?'});

(look in the comments of this answers post for more details. )