I\'m building a site that has a pretty standard RESTful web service to handle persistence and complex business logic. The UI I\'m building to consume this service is using A
The selected answer by Sasxa also helped me but I found that I can bind this to the onSuccess function using .bind(this), that way I don't have to create the function with a fat arrow.
ngAfterViewInit() {
var loginProxy = $.proxy(this.onGoogleLoginSuccess, this);
// Converts the Google login button stub to an actual button.
gapi.signin2.render(
this.googleLoginButtonId,
{
"onSuccess": loginProxy.bind(this),
"scope": "profile",
"theme": "dark"
});
}