which database is perfect to use the ionic
i prefer cordovaSQLite
i m developening an app like to retrive phone contacts to my app now i want to insert those contacts into database by checked functionality so plzz help me how to insert those checked contacts into db
hear is my code
example.controller(“ContactCtrl”, function($scope,$cordovaSQLite){
$scope.insert=function(contact){
var query="INSERT INTO contact(displayName,phoneNumbers) VALUES (?,?)";
$cordovaSQLite.execute(db,query,[contact.displayName,contact.phoneNumbers]).then(function(res){
alert($scope.status=“contacts sucess”);
console.log("insertId: " + res.insertId);
},function(err){
alert($scope.status="contact login :" +err.message);
});
$scope.load();
}
$scope.load=function(){
$scope.selected =[];
$cordovaSQLite.execute(db,‘SELECT displayName,phoneNumbers FROM contact’)
.then(
function(res){
if(res.rows.length){
for(var i=0;i<res.rows.length;i++){
$scope.selected.push(res.rows.item(i));
}
$scope.status=“conacts displayed”;
}
},function(err){
$scope.status=“error for contacts :” +err.message;
}
)
}
});
i use PouchDB
https://pouchdb.com/