ionic添加cordova插件-SQLite 2016-12-22 app ionic **SQLite** *调用SQLite本地数据库储存接口 * ``` cordova plugin add https://github.com/litehelpers/Cordova-sqlite-storage.git ``` **Example** ``` module.controller('MyCtrl', function($scope, $cordovaSQLite) { var db = $cordovaSQLite.openDB({ name: "my.db" }); // for opening a background db: var db = $cordovaSQLite.openDB({ name: "my.db", bgType: 1 }); $scope.execute = function() { var query = "INSERT INTO test_table (data, data_num) VALUES (?,?)"; $cordovaSQLite.execute(db, query, ["test", 100]).then(function(res) { console.log("insertId: " + res.insertId); }, function (err) { console.error(err); }); }; }); ```