I SQLite cordova installiert haben Plugin diese Anweisung verwenden, wie folgend: http://ngcordova.com/docs/plugins/sqlite/
Bitte schauen Sie auf Controller-Code folgende:
.controller('PlaylistsCtrl', function ($scope, $cordovaSQLite) {
$scope.playlists = [
{ title: 'Reggae', id: 1 },
{ title: 'Chill', id: 2 },
{ title: 'Dubstep', id: 3 },
{ title: 'Indie', id: 4 },
{ title: 'Rap', id: 5 },
{ title: 'Cowbell', id: 6 }
];
//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);
// });
//};
})
Fehler:
Haben Sie ngCordova injiziert? z.B. 'angular.module ('starter.controllers', ['ngCordova'])' – Huey
Danke. Das war das Problem! Ich habe verwiesen https://www.thepolyglotdeveloper.com/2014/11/use-sqlite-instead-local-storage-ionic-framework/ –