- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi im using cordoba-sql-legacy plugin ver 0.7.18, and i follow a tutorial but i don't know if is working because the emulator console didn't give me any information, i also try adding a "alert" but it shows nothing so maybe is something wrong on my code i really don't know. as framework im using Ionic with angularJS. any info about i will appreciate a lot thanks =)
My app.js
var db = null;
var example = angular.module('myApp', ['ionic', 'ngCordova'])
.run(function($ionicPlatform, $cordovaSQLite) {
$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
db = $cordovaSQLite.openDB("my.db");
$cordovaSQLite.execute(db, "CREATE TABLE IF NOT EXISTS people (id integer primary key, firstname text, lastname text)");
});
});
example.controller("ExampleController", function($scope, $cordovaSQLite) {
$scope.insert = function(firstname, lastname) {
var query = "INSERT INTO people (firstname, lastname) VALUES (?,?)";
$cordovaSQLite.execute(db, query, [firstname, lastname]).then(function(result) {
console.log("INSERT ID -> " + result.insertId);
alert("result.insertId");
}, function(error) {
console.log(error);
});
};
$scope.select = function(lastname) {
var query = "SELECT firstname, lastname FROM people WHERE lastname = ?";
$cordovaSQLite.execute(db, query, [lastname]).then(function(result) {
if(result.rows.length > 0) {
console.log("SELECTED -> " + result.rows.item(0).firstname + " " + result.rows.item(0).lastname);
} else {
console.log("No results found");
}
}, function(error) {
console.log(error);
});
};
});
My index.html
<div id="campa_de_sangre" class="upage-content vertical-col left hidden"></div>
<div id="consejos" class="upage-content vertical-col left hidden">
<ion-content ng-controller="ExampleController">
<button class="button" ng-click="insert('nic','rad')">Insertar</button>
<button class="button" ng-click="select('rad')">Selecet</button>
</ion-content>
</div>
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Intel XDK Emulate Tab only support the standard Cordova plugins. You will need to test any other plugins on a physical device.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
but the alert in the could should apear even when the pluging do nothing?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The alert is contained within your sqllite code block so it will not execute if the plugin or functionality isn't accessible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nicolas -- please use the Debug tab to test an app that contains non-core plugins.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i test on real device and not event the alert show
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Might have to use the CDT panel to see what is happening. > https://developers.google.com/web/tools/chrome-devtools/
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page