我想第一次使用带有cordova框架的sqlite。正如我在教程中读到的那样,我应该像这样使用ngcordova:
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)");
但在部署时面临问题
Uncaught TypeError: Cannot read property 'openDatabase' of undefined ng-cordova.min.js (9,20659)
答案 0 :(得分:0)
编辑:
指定位置解决问题:
db = $ cordovaSQLite.openDB({name:“DBname.db”,location:'?'});
(请查看此答案帖子的评论以获取更多详细信息。)