本文整理匯總了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));
}