Вы можете поделиться ссылками на социальные сайты, используя эти API
shareTwitter(e) {
e.preventDefault();
var twitterWindow = window.open('https://twitter.com/share?url=' + document.URL, 'twitter-popup', 'height=350,width=600');
if(twitterWindow.focus) { twitterWindow.focus(); }
return false;
}
shareFacebook(e) {
e.preventDefault();
var facebookWindow = window.open('https://www.facebook.com/sharer/sharer.php?u=' + document.URL, 'facebook-popup', 'height=350,width=600');
if(facebookWindow.focus) { facebookWindow.focus(); }
return false;
}
shareGooglePlus(e) {
// var _this = this;
e.preventDefault();
var GooglePlusWindow = window.open('https://plus.google.com/share?url=' + document.URL, 'googleplus-popup', 'height=350,width=600');
if(GooglePlusWindow.focus) { GooglePlusWindow.focus(); }
return false;
}
shareLinkedIn(e) {
var url = document.URL
var title = this.contributionDetails.Title;
var text = document.URL;
window.open('http://www.linkedin.com/shareArticle?mini=true&url='+url+'&title='+title, 'sharer', 'left=0,top=0,width=650,height=420,personalbar=0,toolbar=0,scrollbars=0,resizable=0');
}
HTML-файл
<ul>
<li><a (click)="shareFacebook($event)" class="fbicon"><span class="fa fa-facebook"></span></a></li>
<li><a (click)="shareTwitter($event)" class="twittericon"><span class="fa fa-twitter"></span></a></li>
<li><a (click)="shareGooglePlus($event)" class="gpicon"><span class="fa fa-google-plus"></span></a></li>
<li><a (click)="shareLinkedIn($event)" class="linkicon"><span class="fa fa-linkedin"></span></a></li>
</ul>
</div>