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

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -