Sorry.
This code works:
if(window.cordova) {
// App syntax
var db = $cordovaSQLite.openDB("myapp.db");
} else {
// Ionic serve syntax
var db = window.openDatabase("myapp.db", "1.0", "My app", -1);
}
$cordovaSQLite.execute(db, "CREATE TABLE IF NOT EXISTS teste (name text)");
...
In the controller:
var query = "SELECT * FROM teste";
$cordovaSQLite.execute(db, query).then(function(res) {
if(res.rows.length > 0) {
$scope.teams = res.rows;
//console.log("SELECTED -> " + res.rows.item(0));
} else {
console.log("No results found");
}
}, function (err) {
console.error(err);
});
Occurrs an error at db reference.