Closed mareru closed 7 years ago
I have found that the problem was here:
public getResponse(): String {
if (!this.widgetId) // > change this to if(this.widgetId == null) // widgetId gets to be 0 (returned by google grecaptcha.render() function), so this is why it returned null
return null;
//noinspection TypeScriptUnresolvedVariable
return (<any>window).grecaptcha.getResponse(this.targetRef.nativeElement); // > pass here this.widgetId instead of this.targetRef.nativeElement; otherwise we get error
}
@mareru this commit should fix it.
Hi, @xmaestro, now I have different problem, I get this error:
Invalid ReCAPTCHA client id: [object HTMLDivElement]
It is solved when in getResponse() function, I mentioned in the previous post, this is done:
return (<any>window).grecaptcha.getResponse(this.targetRef.nativeElement); // > pass here this.widgetId instead of this.targetRef.nativeElement, error says it expects id, but gets div element
Also just a note, when your lib is downloaded in node_modules you have .idea files, I suppose those aren't supposed to be there, probably should be removed ...
Sorry i have been busy with other stuff, i'll correct this and check in..
Ok, It has been fixed.
I have used this as a way to get methods from component:
But token ( this.captcha.getResponse()) returns null. What am I doing wrong? Must be something else to be configured in order for this to work?