小编Kou*_*lly的帖子

无法读取未定义的属性“RecaptchaVerifier”

我正在尝试使用 firebase 实现电话身份验证。我正在阅读本指南-> https://fireship.io/lessons/firebase-phone-authentication-with-angular-4-tutorial/

Cannot read property 'RecaptchaVerifier' of undefined<
    at PhoneLoginComponent.ngOnInit (phone-login.component.ts:41)
    at callHook (core.js:2922)
    at callHooks (core.js:2892)
    at executeInitAndCheckHooks (core.js:2844)
    at refreshView (core.js:7213)
    at refreshEmbeddedViews (core.js:8289)
    at refreshView (core.js:7222)
    at refreshComponent (core.js:8335)
    at refreshChildComponents (core.js:6991)
    at refreshView (core.js:7248)
Run Code Online (Sandbox Code Playgroud)

我不断收到上述错误

import { auth } from 'firebase/app';

ngOnInit(): void {
   this.windowRef = this.win.windowRef;
   this.windowRef.recaptchaVerifier = new  auth.RecaptchaVerifier('recaptcha-container');
   this.windowRef.recaptchaVerifier.render();
}
Run Code Online (Sandbox Code Playgroud)

我已经在 app.module.ts 中初始化了 firebase 应用程序

来自 package.json
"firebase": "^7.15.5"
"@angular/fire": "^6.0.2",

javascript firebase-authentication angular

2
推荐指数
1
解决办法
2264
查看次数