This was working fine until now.
ERROR in console – indicating the issue with the line with “renderButton”
login.component.ts
ngAfterViewInit() {
google.accounts.id.initialize({
client_id: 'XXXXX',
callback: this.handleCredentialResponse.bind(this),
auto_select: false,
cancel_on_tap_outside: true,
});
google.accounts.id.renderButton(
document.getElementById('google-button'),
{ theme: 'filled_blue', size: 'large', width: '215' }
);
}
login.component.html
<div id="google-button"></div>.
I tried:
- Moving the code from
ngAfterViewInit
tongOnInit
– it was just a try. - Wrapping the code inside
ngAfterViewInit
tosetTimeout(()=> { // here })
doesn’t work.