How to add reCAPTCHA in angular 2 application?
问题 How to Integrate reCAPTCHA in your Angular 2 Application? 回答1: Assuming that you have Site Key and Client Secret given by reCAPTCHA. Put below code in component. @ViewChild('captchaRef2') captchaRef2: ElementRef; private _reCaptchaId: number; private SITE_ID = [YourSiteKey]; ngAfterViewInit() { const grecaptcha = (window as any).grecaptcha; if (grecaptcha) { this._reCaptchaId = grecaptcha.render(this.captchaRef2.nativeElement, { 'sitekey': this.SITE_ID, 'callback': (resonse) => this