SHARE
TWEET
Untitled
a guest
Dec 13th, 2017
52
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- .service('Message', ['$http','messageService','$ionicPlatform','$cordovaSQLite', function($http,messageService,$ionicPlatform,$cordovaSQLite){
- //hier moet ophalen uit DB komen
- function errorHandler(transaction, error) {
- console.log('Message all ERROR: ' + error.message + ' code: ' + error.code);
- }
- var ret = {
- all: function(){
- console.log('Message all2:');
- db = window.sqlitePlugin.openDatabase({name: "test.db", location:'default'});
- let messageitems = [];
- console.log('Message all: will executesql');
- return db.transaction(function(tx) {
- return tx.executeSql("select * from messages;", [], function(tx, res) {
- console.log("res.rows.length: " + res.rows.length + " -- should be 1");
- console.log("res.rows.item(0).cnt: " + res.rows.item(0).cnt + " -- should be 1");
- });
- } ,function(e) {
- console.log("ERROR: " + e.message);
- });
- console.log('Message all: ITEMS LOADED, count = '+messageitems.length);
- console.log(messageitems);
- },
- add: function(data){
- return $http.post(api_url, data).then(function(resp){
- return resp.data;
- });
- }
- }
- return ret;
- }])
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
