javascript - select data from sqlite in angular. Data is nor rendered -


i'm building mobile application phonegap , angular.js. i'm using sqlite save local data. , problem can't render asynchronous data i'm getting sqlite. problem data not rendered i'have tried $apply method doesn't works.

here code below

function projectlistctrl($scope) {     $scope.test = function(){         db.transaction(querydb, errorcb);          var test1 = function(db_result){         //                $scope.projects = db_result;         //                $scope.$apply();              $scope.projects = db_result;             $scope.$apply(function(){                 $scope.projects = db_result;             });              console.log($scope.projects)         }     var make_result = function (tx, results, $scope) {         querysuccess(tx, results, $scope,test1 );     };      function querysuccess(tx, results, $scope, callback) {         var len = results.rows.length;         var db_result = [];         (var i=0; i<len; i++){             db_result[i] = results.rows.item(i);         }           callback(db_result)         // $scope.projects = results.rows;         // $scope.$apply(); //trigger digest     };      function querydb(tx) {         tx.executesql('select * projects', [], make_result, errorcb);     } } 

}

i guess need use $q service

http://docs.angularjs.org/api/ng.$q


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -