我的控制器中有以下功能,可以使用给定的文本正常工作:
$scope.shareFbBtn=function(){
$ionicPlatform.ready(function() {
$cordovaSocialSharing.shareViaFacebook("Can anyone get further? #initialreaction", "http://i.imgur.com/7PkUq6f.png",null).then(function(result) {
// Success!
console.log("FB success");
}, function(err) {
// An error occurred. Show a message to the user
console.log("Facebook share did not work");
});
})
}
$scope.shareTwitterBtn=function(){
$ionicPlatform.ready(function() {
$cordovaSocialSharing.shareViaTwitter("Can anyone get further? #initialreaction", "http://i.imgur.com/7PkUq6f.png", "http://www.gogatherapp.com/press").then(function(result) {
// Success!
console.log(saying);
}, function(err) {
// An error occurred. Show a message to the user
console.log("Twitter share did not work");
});
})
}
但是,我想给函数动态参数如此
shareFbBtn({{somethingdynamic}})
使用动态文本参数替换标准文本“可以让任何人更进一步”。
非常感谢任何和所有帮助。谢谢:))
编辑: 我已经尝试将参数放在函数中,如下所示,但它不起作用:
HTML:
ng-click="shareFbBtn(Hello);"
控制器:
$scope.shareFbBtn=function(text){
$ionicPlatform.ready(function() {
$cordovaSocialSharing.shareViaFacebook(text, "http://i.imgur.com/7PkUq6f.png",null).then(function(result) {
// Success!
console.log("FB success");
}, function(err) {
// An error occurred. Show a message to the user
console.log("Facebook share did not work");
});
})
}