にアクセスしようとするが、コンソールに、私はエラーました:で検査した後グーグルサインインAPI <a href="https://developers.google.com/identity/sign-in/web/sign-in#specify_your_apps_client_id" rel="nofollow" title="google documentation">google sign-in docs</a>、AUTH作品で説明したように、私はシンプルなGoogleのログインボタンを実装していますunexisting DOM要素に
cb=gapi.loaded_0:247 Uncaught TypeError: Cannot read property 'style' of nullG_
@ cb=gapi.loaded_0:247(anonymous function)
@ cb=gapi.loaded_0:251(anonymous function)
@ cb=gapi.loaded_0:145c.port1.onmessage
@ cb=gapi.loaded_0:72
を縮小さGoogleのコードにはunexisting DOM要素にアクセスしようとするように、それが見えます:
document.getElementById("not_signed_in"+a.El)
//it prints: "not_signed_invrnlb3wwqpsh"
認証は動作しますが、私はangular.jsアプリ内でこれと同じコードを使用しようとすると、エラーが私に影響を及ぼしています。これは、エラーを再現するための簡単なHTMLコードです:
<html>
<head>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="google-signin-client_id" content="MY_APP_ID.apps.googleusercontent.com">
</head>
<body>
<script type="text/javascript">
function onSignIn(googleUser) {
console.log('Name: ' + profile.getName());
}
</script>
<p>please sign in</p>
<div class="g-signin2" data-onsuccess="onSignIn"></div>
</body>
</html>