1
:
.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);
// });
//};
})
エラー:
ngCordovaを注入しましたか?例えば'angular.module( 'starter.controllers'、['ngCordova'])' – Huey
ありがとうございました。それが問題でした!私はhttps://www.thepolyglotdeveloper.com/2014/11/use-sqlite-instead-local-storage-ionic-framework/を紹介しました。 –