1.0.2 • Published 8 years ago
ngx-heyl-social-login v1.0.2
ngx-heyl-snackbar
This package allows you to login with Google and/or Facebook api in AngularX (2+)
Installation
Install npm module :
npm install ngx-heyl-social-loginImport the module :
Open your
app.module.tsfile and import the module like this :import { SocialLoginModule } from "ngx-heyl-social-login"; @NgModule({ imports: [ ..., SocialLoginModule ] })Initialize Google and/or Facebook api in
app.component.ts:Open your
app.component.tsand initialize Google and/or Facebook api :constructor(private socialLoginService: SocialLoginService) { // FacebookAppID : 15 digit number this.socialLoginService.initFacebookProvider("FacebookAppID", "v2.9"); // GoogleAppId : numbers-numbersAndLetters this.socialLoginService.initGoogleProvider("GoogleAppId"); }######! Note : Call these functions will add to your
<head>HTML element you'll need to have. Don't put by yourself Google and Facebook sdk's, or Google's<meta>elementNow yo can use the googleLogin and facebookLogin in your other components :
facebookLogin() { this.socialLoginService.facebookLogin(socialUser => { console.log(socialUser); }); } googleLogin() { this.socialLoginService.googleLogin(socialUser => { console.log(socialUser); }); }