[英]How to share Custom Text in social website using Angular
I have JwSocialButtonsModule
for my social share.我有JwSocialButtonsModule
用于我的社交分享。
JwSocialButtonsModule
is in my app module JwSocialButtonsModule
在我的应用程序模块中
My code:我的代码:
<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>
I need to share custom text instead of url's.我需要共享自定义文本而不是 url。 If i change url to text its throwing error like如果我将 url 更改为文本其抛出错误,例如
Template parse errors:模板解析错误:
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.
How to share text content through social share如何通过社交分享分享文字内容
please try this one to add custom text in between url's请尝试使用此方法在 url 之间添加自定义文本
try this to add custom text in between 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 .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 .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.