Skip to content

ryan-s/angular-directive.g-signin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Angular Google Plus Sign-in Button Directive

Homepage

A good starting place for a Google Plus sign-in button. Specify your client id and you're done. Well, almost. You'll also want a signinCallback() function so you can do something once your users are authenticated.

Usage

  1. Include google-plus-signin.js.
  2. Add directive.g+signin as a dependency to your app.
  3. Add <google-plus-signin clientid="your-client-id"> to your app.
  4. Create a signinCallback() function to detect when your users are authenticated.

Example

See the homepage for an example.

<div ng-app="directive.g+signin">
  <google-plus-signin clientid="620125449078"></google-plus-signin>
  <p>^ This is a Google Plus sign-in button</p>
</div>

###Handling Signin Call Back From Google Plus You can inject $rootScope in your controllers or .run block and Catch 'event:google-plus-signin-success' and 'event:google-plus-signin-error' events and handle them approcriately.

  $rootScope.$on('event:google-plus-signin-success',function(event,authResult){
    //Send Login to server or save into cookie 
  });
   $rootScope.$on('event:google-plus-signin-failure',function(event,authResult){
    //Auth Failure Logic
  });

License

♡ CopyHeart 2013 by Jerad Bitner | Copying is an act of love. Please copy.

About

AngularJS Directive for Google Plus Sign-in Button

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published