@ahmadabbasi76 wrote:
I am using this code to get data from database. but it always prints the result of this line
console.log('outside ret data ' + retData);
as undefined/null. because$cordovaSQLite.execute
is an async call. How can i stop this until i get the result in theretData object
. Please helpCode:
var retData = []; $cordovaSQLite.execute(db, "SELECT * FROM suppliertypes", []).then(function (res) { console.log("total rows found: " + res.rows.length); retData = res; }, function (err) { console.log("Error looking up Supplier types: " + err); }); console.log('outside ret data ' + retData); return retData;
Posts: 2
Participants: 2