Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在Angular中使用Google One Tap_Javascript_Angular_Typescript_Google Identity - Fatal编程技术网

Javascript 在Angular中使用Google One Tap

Javascript 在Angular中使用Google One Tap,javascript,angular,typescript,google-identity,Javascript,Angular,Typescript,Google Identity,我想在我的Angular 11应用程序中使用Google One Tap。接下来,我将添加到我的html中,然后在我的app.component.html中使用以下代码: <div id="g_id_onload" data-client_id="MY_GOOGLE_CLIENT_ID" data-callback="handleCredentialResponse", data-cancel_on_tap

我想在我的Angular 11应用程序中使用Google One Tap。接下来,我将
添加到我的html中,然后在我的
app.component.html
中使用以下代码:

<div id="g_id_onload"
    data-client_id="MY_GOOGLE_CLIENT_ID"
    data-callback="handleCredentialResponse",
    data-cancel_on_tap_outside="false">
</div>

弹出窗口工作正常,但我似乎无法登录。如果我在
app.component.ts
中创建函数
handleCredentialResponse
,我会得到以下错误:
[GSI\U LOGGER]:“回调”的值不是函数。配置被忽略。

如果我尝试使用JavaScript API,Typescript会抛出以下错误:
属性“accounts”在类型“typeof google”上不存在。


我应该怎么做才能在Angular中使用Google One Tap?

我知道我玩游戏有点晚了,但你仍然可以。我认为它有效。谢谢