[英]How to share Custom Text in social website using Angular
我有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 更改為文本其拋出錯誤,例如
模板解析錯誤:
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.
如何通過社交分享分享文字內容
請嘗試使用此方法在 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> <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> <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> <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> </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; }
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.