首页 > 解决方案 > Angular 5 上的 LINE 共享插件

问题描述

Angular5新手在这里。在我的博客应用程序中,我想在 LINE 上分享一篇文章。我已经浏览了LINE 官方文档,但是在构建过程中它失败了。

然后,我尝试了 NG2-social-share,但收到如下错误:

ng2-social-share.d.ts 中的意外值“Ceiboshare”

任何指针都会有很大帮助。

标签: angularangular5

解决方案


CeiboShare package最多支持 Angular 2 版本。由于此软件包未针对最新版本的 Angular 进行更新,因此我们手动进行了社交分享。这是我的component.html

组件.ts

facebookShareUrl = 'https://www.facebook.com/sharer/sharer.php?u=&t=';
shareWithLine() {
  console.log(document.URL);
  window.open('https://lineit.line.me/share/ui?url=' + encodeURIComponent(document.URL) + '&t=' + encodeURIComponent(document.URL));
  return false;
}

推荐阅读