简体   繁体   English

如何使用 Angular 在社交网站中共享自定义文本

[英]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如何通过社交分享分享文字内容

Stackblitz link 闪电战链接

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>&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 .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.

相关问题 如何在 Angular 4 中添加社交分享按钮 - how to add social share button in angular 4 如何在静态html角度网站中使用Azure授权社交提供程序? - How to use Azure Authorization social providers with a static html angular website? Angular 2+ 社交分享链接预览 - Angular 2+ Social Share Link Preview Angular:社交分享按钮,更新 URL 为 Twitter 分享按钮 - Angular: Social share buttons, update URL for Twitter share button 如何使用angular进行angular-social-auth - How to make angular-social-auth using angular 如何在我的angular(6+)PWA应用中带来共享选项,以将媒体共享到社交应用(Messenger,Whatsapp)? - How can i bring share option in my angular(6+) PWA app to share media to social apps(Messenger,Whatsapp)? 如何使用 angular 和 spring boot 添加社交登录功能 - How to add social login functionality using angular and spring boot 无法使用Ionic2 / 3 Social Share共享图像 - Unable to share image using Ionic2/3 Social Share 如何使用角度验证自定义验证模式中的文本 - how to validate text in custom validate patterns using angular Angular4社交媒体Facebook分享页面,包含详细信息 - Angular4 Social Media Facebook share page with details
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM