I am creating simple mobile App using Ionic framework and AngularJs. I have AngularJs view for "single item". I that view I have:
<script> js of social sharing plugin </script>
My social sharing plugin offers config for url and title of data that will be shared:
<script>
Init.share('.share,
{
url: '',
title: ''
});
</script>
How can I combine AngularJs interpolated data in script config, something like this (any sugestions):
<script>
Init.share('.share,
{
url: {{data.url}},
title: {{data.title}}
});
</script>
You can access your variables in your controller using the $scope
object. Like $scope.data.url
This is a very nice tutorial to start with Angular.
This is one of the most famous plugin for social sharing using cordova/phonegap apps
Then you can do something like this in your view:
<a ng-click="share()">share this</a>
And in your controller you can do this
$scope.share = function() {
window.plugins.socialsharing.share('Text to be shared', null, null, 'http://url.here');
};