javascript - Using WebSQL in AngularJs Services -


i building hybrid mobile app using cordova , angularjs. have setup websql store data locally on app. trying abstract websql queries angular service. however, whenever make call method in service controller, nothing gets returned. results variable returns data database when console log on it. doesn't seem return data controller. understand if using plain vanilla js or other frameworks angular code needs wrapped inside $digest / $apply function. i'm not quite sure how apply in instance since $scope variable not available inside angular services. below example on trying achieve.

app.service('userservice', function(){      this.getall = function(){         db.executesql("select * users", [], function(tx, results){             return results.rows;         });     }  });   app.controller('myctrl', function($scope, userservice){      $scope.users = userservice.getall();  }); 

any appreciated.

here pretty easy service can drop app

try one


Comments

Popular posts from this blog

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Restarting Supervisor and effect on FlaskSocketIO -

android - Format a french phone number -