[英]ng-recaptcha ERR: Error: "Uncaught (in promise): [object Null]"
I am using ng-recaptcha package in order to implement Google reCAPTCHA V3 in my web app.我正在使用 ng-recaptcha 包来在我的网络应用程序中实现 Google reCAPTCHA V3。 For that I created a Service with will perform all the needed actions on the client side.
为此,我创建了一个服务,它将在客户端执行所有需要的操作。
import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { ReCaptchaV3Service, OnExecuteData } from 'ng-recaptcha'; import { environment } from 'src/environments/environment'; const BACKEND_URL = environment.apiUrl + '/contact/'; @Injectable() export class ContactService { constructor( private http: HttpClient, private recaptchaV3Service: ReCaptchaV3Service ) {} public sendContactForm(data): void { this.recaptchaV3Service.execute('contactForm').subscribe(data => { console.log(data); }); // this.http.post(BACKEND_URL, data) // .subscribe((responseData) => { // console.log(responseData); // }); } }
Unfortunatelly, when executing recaptcha (on sendContactForm method), I get the following error:不幸的是,在执行 recaptcha 时(在 sendContactForm 方法上),我收到以下错误:
"Uncaught (in promise): [object Null]" “未捕获(承诺):[对象空]”
What is wrong here?这里有什么问题?
Solution: Add the domain in the recaptcha admin area:解决方法:在recaptcha管理区添加域:
localhost 127.0.0.1
There is another question that asks the same thing and requires the same solution.还有另一个问题提出了相同的问题并需要相同的解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.