vendredi 30 octobre 2015

Error when trying to get a single record form SQLite (Ionic/Angularjs/SQLite)

I am trying to display a single record from an SQLite. But got an error from console:

"Error: Failed to execute 'item' on 'SQLResultSetRowList': The index provided (0) is greater than or equal to the maximum bound (0). at Error (native) at Object.self.getById"

The caller

$scope.DisplayMember = function(RegId) {
      Team.get(RegId).then(function(data){  $scope.Singledata= data;});
    };

Called this:

self.get = function(memberId) {
      var parameters = [memberId];
      return DBA.query("SELECT id, name FROM team WHERE id = (?)", parameters)
        .then(function(result) {
          return DBA.getById(result);
        });
    }

And lastly this:

// Proces a single result
    self.getById = function(result) {
      var output = null;
      output = angular.copy(result.rows.item(0));
      return output;
    }

Thanks for your kind help

Aucun commentaire:

Enregistrer un commentaire