angular - 用于在 Twitter 上发布视频的 Angular 8 社交分享按钮
问题描述
我是 Angular 8 的新手。如何在按钮点击时在 Twitter 上发布我的 Angular 视频?使用这些代码,我可以在 twitter 上分享图片,但不能分享视频。所以我想如果有人知道如何分享视频。
html
<div class="modal-footer pt-0 border-top-0">
<div class="button-box">
<button type="button" class="btn btn-primary" (click)="onTwitter(TwitterComment.value)"><span>Post</span></button>
</div>
</div>
TS代码:
onTwitter(TwitterComment) {
var CloudUrl = this.ImageBigThumbPath;
this.service.formData = new PartnerWebPhotos;
this.service.formData.CloudImageUrl = this.ImageBigThumbPath;
this.service.formData.TwitterComment = TwitterComment;
this.service.Twitter(this.service.formData).then(
(res) => {
console.log(this.service.formData.TwitterAuthToken);
window.open(this.service.formData.CloudImageUrl, 'popup_window', 'left=50,top=50,width=400,height=400,titlebar=0,toolbar=0,resizable=false');
this.service.twitterPost();
this.modalRef.hide();
},
(err: HttpErrorResponse) => {
console.log(err);
}) }
服务电话
twitterPost()
{
return this.http.get(this.rootURL+'/ClaimPhotos/twitterPost')
}
Twitter(formData:PartnerWebPhotos )
{
return this.http.post(this.rootURL+'/ClaimPhotos/twitter',formData).toPromise()
.then(res => this.formData = res as PartnerWebPhotos);;
}
WebApi 调用
[HttpPost("twitter")]
public async Task<ActionResult<PartnerWebPhotos>> TwitterPost(PartnerWebPhotos partnerWebPhotos)
{
TempData["close"] = null;
string AuthTokens = string.Empty;
TempData["msg"] = null;
if (partnerWebPhotos.CloudImageUrl != null)
{
partnerWebPhotos.CloudImageUrl = partnerWebPhotos.CloudImageUrl.Replace("https://res.cloudinary.com/www-commdel-net/image/upload/", "https://res.cloudinary.com/www-commdel-net/image/upload/" + "w_500,h_500,c_fit/");
TwitterPath = partnerWebPhotos.CloudImageUrl;
TwitterComment = partnerWebPhotos.TwitterComment;
//Session["Redirect"] = 2;
string response = await utility.RequestToken();
if (response != string.Empty)
{
string[] responseArray = response.Split('&');
string RequestToken = responseArray[0].Split('=')[1];
TokenSecret = responseArray[1].Split('=')[1];
AuthToken = responseArray[0].Split('=')[1];
//EditPhotoModel.comments = "";
AuthTokens = AuthToken;
partnerWebPhotos.CloudImageUrl = "https://api.twitter.com/oauth/authorize?oauth_token=" + AuthToken;
}
}
return partnerWebPhotos;// "OpenTwitterLogin( '" + AuthTokens + "')";
}
解决方案
推荐阅读
- mysql - Mysql执行stmt输出
- c# - StringBuilder 在 ForEach 循环下不工作
- wordpress - 注销后 Woocommerce 购物车不清楚
- python-3.x - Python3 numpy 错误:ValueError:使用序列设置数组元素
- yammer - Yammer REST API - 在新消息之前获取所有消息较旧的消息,因此无法返回 old_than
- spring-boot - 遗留数据库上的反应式编程风格
- javascript - 测试新正则表达式功能的浏览器兼容性
- flask - 访问 Flask 应用程序 URL 总是返回 404
- c# - 如何过滤掉 VS 诊断工具中捕获的异常?
- ios - 如何在 Gallery App IOS 中显示文档目录中的图像?