Why does ngcordova share not work?

0

I have a mobile app and am using the ngcordova plugin, cordovaSocialSharing . But when I did as the documentation, when I click on sharing nothing happens.

Controller

.controller('ShareCtrl', function($ionicPlatform, $scope, $cordovaSocialSharing) {
$ionicPlatform.ready(function() {

    var message = 'This is a demo message';
    var subject = 'This is a demo message';
    var link = 'http://somerandom.link/image.png'; // fake image

    $scope.nativeShare = function() {
        $cordovaSocialSharing
            .share(message, subject, link); // Share via native share sheet
    };

    //checkout http://ngcordova.com/docs/plugins/socialSharing/
    // for other sharing options
});
})

Button

 <div ng-click="shareAnywhere()" ng-controller="ExampleController" style="text-align: center">
 <i style="font-size: xx-large" class="ion-android-share-alt"></i><br>
 Partilhar
 </div>
    
asked by anonymous 26.09.2015 / 19:00

1 answer

1

You have to keep in mind that the cordova plugins will not work in the browser. You need to emulate a device or build the app and install it on your device.

Your button should also be modified to call the nativeShare function you mentioned in the ShareCtrl controller.

<div ng-click="nativeShare()" ng-controller="ExampleController" style="text-align: center">
  <i style="font-size: xx-large" class="ion-android-share-alt"></i><br> Partilhar
</div>
    
28.09.2015 / 19:12