ngx-facebook-kit
v0.0.1
Published
Use Facebook Account Kit with Angular5~ (https://developers.facebook.com/docs/accountkit/webjs)
Downloads
2
Maintainers
Readme
Ngx Facebook Account Kit
This module is used for Angular 5.
This module help you to use Facebook Account Kit as service.
How to use:
Installation:
npm install ngx-facebook-kit
Import service:
Edit in src/app/app.module.ts
:
//...
import { NgxFacebookKitModule, NgxFacebookKitService } from 'ngx-facebook-kit';
const facebookKitLanguage = environment.facebookKit.language;
const facebookKitConfigs = {
appId: '<appId>',
state: '<state>',
version: '<version>',
fbAppEventsEnabled: '<fbAppEventsEnabled>',
debug: '<debug>',
redirect: '<redirect>',
display: '<display>'
};
@NgModule({
//...
imports: [
//...
NgxFacebookKitModule,
],
bootstrap: [AppComponent]
})
export class AppModule {
constructor(ngxFcebookKitService: NgxFacebookKitService) {
ngxFcebookKitService.init(facebookKitConfigs, facebookKitLanguage);
}
}
And call in component:
constructor(private _ngxFacebookKitService: NgxFacebookKitService) {
}
Login using phone
<!-- Using directive -->
<button [ngxLoginFacebookKitPhone]="{countryCode: '+84', phoneNumber: '0909999999'}"
(successEvent)="loginSuccess($event)"
(errorEvent)="loginError($event)">
//Using controller
login() {
this._ngxFacebookKitService
.loginPhone('+84', '0909999999')
.subscribe((response) => {}, (error) => {});
}
Login using email
<!-- Using directive -->
<button [ngxLoginFacebookKitEmail]="'[email protected]'"
(successEvent)="loginSuccess($event)"
(errorEvent)="loginError($event)">
//Using controller
login() {
this._ngxFacebookKitService
.loginEmail('[email protected]')
.subscribe((response) => {}, (error) => {});
}