What I actually want is that. I want to share my data with whatsapp. i managed to do it but the problem is that, when I send the data it looks like this
"J&J Baby Cl Lemon Frsh 250ML,6, \n","J&J Baby Cl Lemon Frsh 250ML,6, \n","J&J Baby Cl Lemon Frsh 250ML,9, \n","J&J Baby Cl Lemon Frsh 250ML,4, \n","J&J Baby Cl Lemon Frsh 250ML,6, \n","J&J Baby Cl Lemon Frsh 250ML,5, \n"]
i want to send a list of items like this:
1)J&J Baby Cl Lemon Frsh 250ML [6]
2)J&J Baby Cl Lemon Frsh 250ML [4]
3)J&J Baby Cl Lemon Frsh 250ML [3]
4)J&J Baby Cl Lemon Frsh 250ML [8]
This is my HTML:
<ion-option-button class="button-calm"
ng-click="share(item.id)">
Share
</ion-option-button>
This is my CODE:
$scope.share = function (listid) {
$scope.detaillist = [];
var db = $cordovaSQLite.openDB({ name: "Bd_DB.db" });
var query = "SELECT * FROM ListDetail WHERE listid= ?";
$cordovaSQLite.execute(db, query, [listid]).then(function (res) {
for (var i = 0; i < res.rows.length; i++) {
$scope.detaillist.push(res.rows.item(i));
}
var shareValue = [];
for (i = 0 ; i < $scope.detaillist.length; i++) {
shareValue.push($scope.detaillist[i].title + ',' + $scope.detaillist[i].quantity + ',')
}
alert(shareValue);
$cordovaSocialSharing.share(shareValue)
.then(function (result) {
// Success!
}, function (err) {
alert(JSON.stringify("error" + err));
// An error occurred. Show a message to the user
});
}, function (err) {
return err;
alert(JSON.stringify(err));
console.error(err);
});
};