Javascript ngCordova和社交共享出错
错误: HTML: app.jsJavascript ngCordova和社交共享出错,javascript,angularjs,cordova,ionic-framework,Javascript,Angularjs,Cordova,Ionic Framework,错误: HTML: app.js .controller('PlayCtrl', function($scope, $cordovaSocialSharing) { $scope.shareAnywhere = function() { $cordovaSocialSharing.share("This is your message", "This is your subject", "www/imagefile.png", "https://www.thepolyglo
.controller('PlayCtrl', function($scope, $cordovaSocialSharing) {
$scope.shareAnywhere = function() {
$cordovaSocialSharing.share("This is your message", "This is your subject", "www/imagefile.png", "https://www.thepolyglotdeveloper.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");
});
}
})
因此,我使用(sudo npm install g-cordova)安装了cordova,并使用bower安装了ng cordova。我已经添加了socialshare插件,所有文件都位于我的ionic应用程序文件目录的插件文件夹中
我不知道要让它正常工作还需要做什么:(检查你的文件夹树。ng-cordova.js实际上在“lib/ngCordova/dist”中吗?有时它会安装在其他与bower相关的目录中。是的,我检查了…我确实单独从github下载了cordova.js,但我将它放在了正确的位置。我是否需要在ios/andriod上构建cordova才能工作…因为我还没有。我正在做的一切都是在safari上测试
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="lib/ngCordova/dist/ng-cordova.js"></script>
<script src="cordova.js"></script>
.controller('PlayCtrl', function($scope, $cordovaSocialSharing) {
$scope.shareAnywhere = function() {
$cordovaSocialSharing.share("This is your message", "This is your subject", "www/imagefile.png", "https://www.thepolyglotdeveloper.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");
});
}
})
angular.module('starter', ['ionic', 'starter.controllers', 'chart.js','ngCordova'])