Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 在db.transaction函数中获取Error.code=0_Angularjs_Sqlite_Cordova_Ionic_Ripple - Fatal编程技术网

Angularjs 在db.transaction函数中获取Error.code=0

Angularjs 在db.transaction函数中获取Error.code=0,angularjs,sqlite,cordova,ionic,ripple,Angularjs,Sqlite,Cordova,Ionic,Ripple,我正在用Ionic在Phonegap中创建一个项目。我正在用sqlite和本地存储插入和获取动态内容 我创建了一个仪表板控制器,下面是我的仪表板控制器代码 angular.module('myWallet').controller('dashCtrl', function($scope,$state,$ionicPopup,$ionicHistory,AuthService){ $scope.data = {}; //goBack $scope.myGoBack = funct

我正在用Ionic在Phonegap中创建一个项目。我正在用sqlite和本地存储插入和获取动态内容

我创建了一个仪表板控制器,下面是我的仪表板控制器代码

angular.module('myWallet').controller('dashCtrl',  

function($scope,$state,$ionicPopup,$ionicHistory,AuthService){

 $scope.data = {};  

//goBack 
$scope.myGoBack = function() {
 $ionicHistory.goBack();
};

//********** error code function ************
function errorDashFunction(err)
{
   alert("Error Code: "+error.code);
}

//********** Success code function ************
function successDashFunction()
{
  var totalCashInHand = Coming_totalIncome - Coming_totalExpenses;
  alert(totalCashInHand );
}

var current_user_id=window.localStorage.getItem('userid');

var Coming_totalIncome = 0;
var Coming_totalExpenses= 0;
var Coming_totalCashInHand = 0;

//********** Fetching Values from DB ************
db.transaction(function (tx) { 

tx.executeSql("SELECT SUM(amount) as Totalincome FROM WALLET_INCOMES WHERE user_id ='"+current_user_id+"'", [], function(tx,results){
  console.log(results);

  if(results.rows[0].Totalincome != null)
  {
     Coming_totalIncome = results.rows[0].Totalincome;
  }

});

tx.executeSql("SELECT SUM(amount) as Totalexpenses FROM WALLET_EXPENSES WHERE user_id ='"+current_user_id+"'", [], function(tx,results){

   if(results.rows[0].Totalexpenses != null)
  {
  Coming_totalExpenses = results.rows[0].Totalexpenses;
  }

});

 return true;
},errorDashFunction,successDashFunction);


})
当我在Ripple上运行此代码时,它会提醒TotalCashInHand Price。 但当我在手机上运行此代码时,它总是显示错误代码“0”