本文整理汇总了TypeScript中ngx-facebook.FacebookService类的典型用法代码示例。如果您正苦于以下问题:TypeScript FacebookService类的具体用法?TypeScript FacebookService怎么用?TypeScript FacebookService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FacebookService类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(private fb: FacebookService, private accountService: AccountService) {
let initParams: InitParams = {
appId: '2012751978958165',
xfbml: true,
version: 'v2.8'
};
fb.init(initParams);
}
示例2: constructor
constructor(private fb: FacebookService, private translate: TranslateService, private authorizationService: AuthorizationService, private router: Router) {
console.log('Initializing Facebook');
fb.init({
appId: '229433700788344',
version: 'v2.9'
});
translate.addLangs(['en', 'ru']);
translate.setDefaultLang('en');
const browserLang = translate.getBrowserLang();
translate.use(browserLang.match(/en|ru/) ? browserLang : 'en');
}
示例3: isLoggin
isLoggin(): Promise<boolean> {
return this.fb.getLoginStatus()
.then((response: LoginStatus) => {
return response.status === 'connected';
})
.catch(e => { return false; })
}
示例4: loginWithFacebook
loginWithFacebook(): void {
this.fb.login()
.then((response: LoginResponse) => console.log(response))
.catch((error: any) => console.error(error));
}
示例5: InitService
public InitService() {
let initParams: InitParams = {
appId: '447972592264310',
xfbml: true,
version: 'v2.10'
};
this.facebookService.init(initParams);
}
示例6: addFacebook
addFacebook(): void {
this.fb.login({ scope: "user_posts", enable_profile_selector: true })
.then((response: LoginResponse) => {
//Obtenida la respuesta, aĂąado la cuenta al servidor
this.accountService.addAccount({
type: 'facebook',
facebook_id: response.authResponse.userID
})
})
.catch((error: any) => console.error(error));
}
示例7: faceshare
faceshare(url: string) {
let params: UIParams = {
href: url,
method: 'share'
};
this.fb.ui(params)
.then((res: UIResponse) => console.log(res))
.catch((e: any) => console.error(e));
}
示例8: attachments
attachments(post_id) {
let attachments = [];
return this.fb.api(post_id + '/attachments').then(
(res) => {
if (res.data[0].media) {
attachments.push(res.data[0].media.image.src);
}
else {
if (res.data[0].subattachments) {
res.data[0].subattachments.data.forEach((element) => {
attachments.push(element.media.image.src);
})
}
}
return attachments;
}
).catch(e => console.log(e));
}
示例9: me
me() {
return this.fb.api('me?fields=posts.limit(7)')
.then(res => res.posts)
.catch(e => console.log(e));
}