I have been trying to implement sign in with Google in angular 2 in a separate login component. I am unable to implement it with the documentation available in Google https:
pretty much none of this worked for me because I want the google button made by Google. @mathhew eon's code worked but that does not use their button.
so I threw the google data-success function on the window and it works PERFECT! It also has the added advantage of if the user is already logged in it will auto call the googleLogin function.
html
In your index.html put this in the head:
then in your ngOnInit
ngOnInit() {
(window as any).googleLogin = this.googleLogin
}
public googleLogin(userInfo) {
console.log(userInfo)
}