2016-08-10 6 views
0

저는 안드로이드 프로그래밍에 새로운 경험이 있으며, 현재 Ionic Framework를 사용하여 내 안드로이드 앱을 공유하는 기능을하려고합니다. 이것은이다 :Ionic shareAnywhere 버튼이 작동하지 않습니다.

 <ion-item menu-close class="item item-icon-left" ng-click="shareApp('Aplikasi BeDA: ', '{{namaapk}}', '', 'https://play.google.com/store/apps/details?id={{apk}}')">    
      <i class="icon ion-android-share-alt {{appcolor}}"></i> 
      <small>SHARE APLIKASI<small>      
     </ion-item> 

이것은`(() 함수는 { 은 '엄격한 사용';

angular 
    .module('bps.menu') 
    .controller('MenuController', function($scope, $stateParams, $ionicHistory, $http, $cordovaAppRate, $cordovaSocialSharing, $ionicPopup, Config, Color) { 
     var xhr = $http({method: 'get', url:'json/menu.json'}); 
     xhr.success(function(data){ 
      $scope.namaapk = Config.NamaAplikasi; 
      $scope.apk = Config.GooglePlay; 
      ... 
      $scope.appcolor= Color.AppColor; 
     }); 
     ... 
     $scope.shareApp = function(message, subject, file, link) { 
      $cordovaSocialSharing 
      .share(message, subject, file, link+$scope.apk) 
      .then(function(result) { 
       // Success! 
      }, function(err) { 
       alert("Error. We're sorry."); 
      }); 
     } 
     ... 
     $scope.goBack = function() { 
      console.log('back'); 
      $ionicHistory.goBack(); 
     }; 


    }) 
})();` 

그러나 크롬 콘솔에서 작동하지 않습니다는 말했다 :

TypeError: Cannot read property 'socialsharing' of undefined 

나는 단지 Cordova의 버그라고 생각했지만, 휴대 전화에 앱을 설치하면 기능이 전혀 작동하지 않았다. 내가 무엇을 놓쳤는가?

답변

1

프로젝트에 추가 했습니까? 명령 줄은 다음과 같습니다.

ionic plugin add cordova-plugin-x-socialsharing 
+0

Thanks Pablo and e666. 하지만 올바른 구문은'ionic plugin add cordova-plugin-x-socialsharing'입니다. 나는 당신의 대답을 편집했습니다. – Safira

관련 문제