1

我有JwSocialButtonsModule我的社会份额。
JwSocialButtonsModule在我的应用模块中

我的代码:

<div class="jumbotron">
<div class="row">
    <div class="col">
        <fb-like url={{url}}></fb-like>
    </div>
    <div class="col">
        <google-plus url={{url}}></google-plus>
    </div>
    <div class="col">
        <tweet url={{url}} text={{text}}></tweet>
    </div>
    <div class="col">
        <linkedin-share url={{url}}></linkedin-share>
    </div>
    <div class="col">
        <pin-it url={{url}} media={{imageUrl}} description={{text}}></pin-it>
    </div>
</div>

我需要共享自定义文本而不是 url。如果我将 url 更改为 text 它的抛出错误,例如

模板解析错误:

Can't bind to 'text' since it isn't a known property of 'fb-like'.
1. If 'fb-like' is an Angular component and it has 'text' input, then verify that it is part of this module.
2. If 'fb-like' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

如何通过社交分享分享文字内容

Stackblitz 链接

4

1 回答 1

0

请尝试这个在 url 之间添加自定义文本

试试这个在 url 之间添加自定义文本

 window.open('https://twitter.com/intent/tweet?text=%20Check%20up%20this%20awesome%20content' + encodeURIComponent(document.title) + ':%20 ' + encodeURIComponent('https://freadee.com/#/food/detail/' + this.shareFoodId + 'add custom text here'));

.html

<div class="modal-body text-center">
        <!-- Add font awesome icons -->
        <!-- <share-buttons show="11"></share-buttons> -->
        <a class="social-icon social-icon-facebook fab fa-facebook-f m-1"
          href="https://www.facebook.com/sharer/sharer.php?u=&t=" title="Share on Facebook" target="_blank"
          (click)="sharefacebookUrl(foodid)"></a>&nbsp;

        <a class="social-icon social-icon-twitter fab fa-twitter m-1" href="https://twitter.com/intent/tweet?"
          target="_blank" title="Twitter" (click)="sharetweetUrl(foodid)"></a>&nbsp;

        <a class="social-icon social-icon-envelope fas fa-envelope m-1" href="mailto:?subject=&body=:%20"
          target="_blank" title="Email" (click)="sharemailUrl(foodid)" click=""></a>&nbsp;

        <a class="social-icon social-icon-instagram fab fa-instagram m-1" href="https://instagram.com/accounts/login/?"
          target="_blank" title="Instagram" (click)="shareinstaUrl(foodid)"></a>&nbsp;



      </div>

.ts

sharefacebookUrl(foodid) {
    this.shareFoodData = foodid
    this.shareFoodId = foodid.food_id
    this.share();
    // window.open('https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent('https://freadee.com/#/food/detail/' + this.shareFoodId+ 'add custom text here'));
    return false
  }

  sharetweetUrl(foodid) {
    window.open('https://twitter.com/intent/tweet?text=%20Check%20up%20this%20awesome%20content' + encodeURIComponent(document.title) + ':%20 ' + encodeURIComponent('https://freadee.com/#/food/detail/' + this.shareFoodId+ 'add custom text here'));
    return false;
  }

  sharemailUrl(foodid) {
    window.open('mailto:?subject=' + encodeURIComponent(document.title) + '&body=' + encodeURIComponent('https://freadee.com/#/food/detail/' + this.shareFoodId+ 'add custom text here'));
    return false;
  }

  shareinstaUrl(foodid) {
    window.open('https://instagram.com/accounts/login/?text=%20Check%20up%20this%20awesome%20content' + encodeURIComponent(document.title) + ':%20 ' + encodeURIComponent('https://freadee.com/#/food/detail/' + this.shareFoodId+ 'add custom text here'));
    return false;
  }

于 2019-12-11T06:55:02.180 回答