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.
- Include
google-plus-signin.js
. - Add
directive.g+signin
as a dependency to your app. - Add
<google-plus-signin clientid="your-client-id">
to your app. - Create a
signinCallback()
function to detect when your users are authenticated.
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
});
♡ CopyHeart 2013 by Jerad Bitner | Copying is an act of love. Please copy.