We are trying to update MobileNumber in SQLite table after that we need hit server using mobileNumber.But We are unable to update and get data from Services also.We are trying like this
.controller('pETLoverSCtrl', function($scope,$cordovaSQLite,$http,$location,$window,BlankService) {
$scope.sendNumber = function () {
**//DB**
var db = $cordovaSQLite.openDB("SaveDOGDB.db");
$cordovaSQLite.execute(db, 'CREATE TABLE IF NOT EXISTS UserInfo (id INTEGER PRIMARY KEY AUTOINCREMENT, MobileNumber INTEGER,UserName TEXT,UserPhoto BLOB,UserAddress TEXT,UserPinCode INTEGER,ServiceProvider TEXT,UserPassword TEXT)');
//GET mobile number
var MobileNumberGet = $scope.RegisterMobileNumber;
alert(MobileNumberGet);
alert("Update UserInfo SET MobileNumber="+MobileNumberGet+"");
// execute INSERT statement with parameter
$cordovaSQLite.execute(db, 'Update UserInfo SET MobileNumber='+MobileNumberGet+'')
.then(function(result) {
console.log("Message updated successful, cheers!");
}, function(error) {
console.log("Error on saving: " + error.message);
})
**//Services**
$http({
method : "GET",
url : 'http://ift.tt/1UmpFBr' + MobileNumberGet
}).then(function mySucces(response) {
alert('suss'+response.data);
$location.path("/page2"); //two
}, function myError(response) {
alert(response);
console.log('ERR'+response.message);
});
}
});
When we tried two functionliys differently both are working fine but We need After update db.We need Get data form server.We alreday add SqLite Plugin to our Project :using this
Cordova plugin add http://ift.tt/1hfTp15
please guide to us and tell me what wrong with our code
Aucun commentaire:
Enregistrer un commentaire