https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git

  从上面的连接下载 插件

1.肯定是要加入 下面的那个文件的吖 从这里下载 ngCordova.min.js

2. 不要忘记了 在app.js 中注入 ngCordova 

1 angular.module('starter', ['ionic', 'ngCordova'])

3. 在控制器中  注意:不要忘记注入  $cordovaSocialSharing ,不然会报错的呀

.controller("yourCtr", function($scope, $cordovaSocialSharing) {
 
    $scope.shareAnywhere = function() {
        $cordovaSocialSharing.share("This is your message", "This is your subject", "www/imagefile.png", "http://www.baidu.com");
    }
 
    $scope.shareViaTwitter = function(message, image, link) {
        $cordovaSocialSharing.canShareVia("twitter", message, image, link).then(function(result) {
            $cordovaSocialSharing.shareViaTwitter(message, image, link);
        }, function(error) {
            alert("Cannot share on Twitter");
        });
    }
 
});

 

4.your HTML 中call this function

<button class="button" ng-click="shareAnywhere()">Share anywhere</button>
<button class="button" ng-click="shareViaTwitter('some message', null, 'http:www.baidu.com')">Share on Twitter</button>

5.好了  完成了....这个插件好像可以分享到QQ空间去的呢  当然前提是你的手机上有下载 QQ空间了...hahha

posted on 2014-10-30 10:10  ทดสอบ  阅读(571)  评论(0)    收藏  举报