Closed shamusschubert closed 1 year ago
Currently I'm following workaround:
Basically there is a directive which loads google button, so we can copy paste it to our application and use it where we need.
1: login.html (or when you need this button)
<ts-google-signin></ts-google-signin>
2:
import {Directive, ElementRef} from '@angular/core';
import {take} from 'rxjs';
import {SocialAuthService} from '@abacritt/angularx-social-login';
@Directive({
selector: 'ts-google-signin',
})
export class GoogleSigninButtonDirective {
constructor(
el: ElementRef,
socialAuthService: SocialAuthService
) {
socialAuthService.initState.pipe(take(1)).subscribe(() => {
// @ts-ignore
google.accounts.id.renderButton(el.nativeElement, {
theme: "filled_blue",
size: "medium",
"data-logo_alignment": "left",
"width": '249px',
});
})
}
}
google scripts will be pre-loaded by "socialAuthService.initState"
This worked for me. Thank you @nikoristar. I did it inside one component instead of directive.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Discussed in https://github.com/abacritt/angularx-social-login/discussions/566