Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

Facebook share

$
0
0

Hi arsene, Go to your project directory in the nodejs command prompt and install the sharing plugin using this code.

First, check if you have installed ngCordova, if not install, you can install ngCordova using bower

> bower install ngCordova

You dont have bower? you can install bower in your node interpreter using npm install bower

> cordova plugin add cordova-plugin-x-socialsharing

After successful installation

Add $cordovaSocialSharing to your controller and do the following code

message = "Your message"
subject  = "Your title"
logo      = "Your logo url"
url       =  "The url of the app"
>  $scope.shareAnywhere = function() {

>         $cordovaSocialSharing.share(message, subject, logo, url);
>     }
>
>     $scope.shareViaTwitter = function() {
>         $cordovaSocialSharing.canShareVia("twitter", message, logo, url).then(function(result) {
>             $cordovaSocialSharing.shareViaTwitter(message, logo, url);
>         }, function(error) {
>             alert(error)
>         });
>     }

>     $scope.shareViaFacebook = function() {
>         $cordovaSocialSharing.canShareVia("facebook", message, logo, url).then(function(result) {
>             $cordovaSocialSharing.shareViaFacebook(message, logo, url);
>         }, function(error) {
>              alert(error)
>         });
>     }

Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>