angularjs - cordovaSocialSharing in ionic not working -
i'm using plugin cordovasocialshare of ngcordova make sharing on social networks in application. problem don’t have actions returned, , when analyzing adb logs, returns me following error:
i / chromium (3635): [info: island (20306)] "typeerror: can not call method 'cansharevia' of undefined / chromium (3635): scope @ $ scope.shareviawhatsapp. (file: ///android_asset/www/js/app.js: 22: 31)
look @ code:
html
<ion-option-button class="button-dark button-facebook" ng-click="shareanywhere()"> <i class="icon ion-social-facebook icon-facebook"></i> </ion-option-button>
angularjs
$ionicplatform.ready(function(){ $scope.shareviawhatsapp = function(message, image, link) { $cordovasocialsharing.cansharevia("whatsapp", message, image, link).then(function(result) { $cordovasocialsharing.shareviawhatsapp(message, image, link); }, function(error) { alert("cannot share on whatsapp"); }); } $scope.shareanywhere = function() { $cordovasocialsharing.share("this message", "this subject", "www/imagefile.png", "http://blog.nraboy.com"); }});
someone me please?
anyway, again, decided problem myself ...
the result:
in command line:
ionic plugin add cordova-plugin-socialsharing
angularjs:
$scope.share = function($title, $excerpt, $permalink) { $ioniclistdelegate.closeoptionbuttons(); window.plugins.socialsharing.share($title, $excerpt, null, $permalink); }
html:
<ion-option-button class="button-positive button-share" ng-click="share('{{item.title}}', '{{item.excerpt}}', '{{item.permalink}}')"> <i class="icon ion-android-share-alt"></i> </ion-option-button>
Comments
Post a Comment