Why doesn’t sharing the agreement work?

Asked

Viewed 81 times

0

I have a mobile app and am using the plugin ngcordova, the cordovaSocialSharing. But when I did like the documentation, when I click to share 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
});
})

Knob

 <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>
  • Did you start the app variable? Another thing, put ng-controller before ng-click. Can you share this source somewhere?

  • ng-controller is already up there and the app variable is initialized

  • Even put the ng-app tag in html?

  • Has no index.html ng-app="Starter"

  • index.html is the same as your html with controller?

  • The controller is not on another page but I am using Routes

  • Try to put everything on the same page

Show 2 more comments

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 function nativeShare that you mentioned in controller ShareCtrl.

<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>
  • I already modified and tested with the app installed on the device and does not work nothing when I click

  • Have you configured/enabled ng-Cordova correctly? You need to install the plugin, and embed it within the app.js dependencies

  • Yes I have it all until I am using other ngcodova plugins and function only this and that

Browser other questions tagged

You are not signed in. Login or sign up in order to post.