Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

Disable async db call

$
0
0

@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 the retData object. Please help

Code:

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

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>