lundi 28 septembre 2015

Ionic List populate data from Sqlite

I am building an mobile application using Ionic and Sqlite.I am successful in storing data to the Sqlite database, retrieving the data back from the database and printing it to the console. Now, I am unable to figure out how to populate the data form the database in an ionic list

$scope.load = function() {

     $cordovaSQLite.execute(db, 'SELECT * FROM cart ORDER BY id DESC')
     .then(
         function(res) {
              if (res.rows.length > 0) {
                  for (var i=0; i<res.rows.length; i++) {
                     console.log("Product ID: " + res.rows.item(i).productID + " Product Name : " + res.rows.item(i).productName);
                  }
               }
          },
          function(error) {
               console.log("Error on loading: " + error.message);
          }
       );
    }

I need to display res.rows.item(i).productID & res.rows.item(i).productName in an ionic list.

Aucun commentaire:

Enregistrer un commentaire