加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

在Angular 2中使用Facebook SDK

发布时间:2020-12-17 07:21:19 所属栏目:安全 来源:网络整理
导读:我一直在读这个: https://developers.facebook.com/docs/sharing/reference/share-dialog 我需要导入facebook SDK才能使用以下代码: FB.ui({ method: 'share',href: 'https://developers.facebook.com/docs/',},function(response){}); 我如何使用Angular
我一直在读这个: https://developers.facebook.com/docs/sharing/reference/share-dialog

我需要导入facebook SDK才能使用以下代码:

FB.ui({
  method: 'share',href: 'https://developers.facebook.com/docs/',},function(response){});

我如何使用Angular 2应用程序导入facebook SDK?

不需要使用facebook sdk我们可以在同一个ts文件中使用窗口位置,如下所示.而且我们也可以为twitter linkedin这样的社交媒体做同样的事情.

Facebook:

popupfacebook() {
    let url = 'http://www.facebook.com/sharer.php?u='+ this.shareLink;
       let newwindow=window.open(url,'name','height=500,width=520,top=200,left=300,resizable');
  if (window.focus) {
      newwindow.focus()
  } 
}

推特:

popuptweet(){
       let url = 'https://twitter.com/intent/tweet?text='+ this.shareLink;
       let newwindow=window.open(url,resizable');
  if (window.focus) {
      newwindow.focus()
}}

Linkedin:

popuplinkedin(){
      let url ='https://www.linkedin.com/shareArticle?mini=true&url='+this.shareLink;
       let newwindow=window.open(url,resizable');
  if (window.focus) {
      newwindow.focus()
  }
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读