From 15369cfaa154f90315096e1ac634690817bc8a50 Mon Sep 17 00:00:00 2001 From: Enngage Date: Tue, 25 Sep 2018 08:31:15 +0200 Subject: [PATCH] Renders captcha outside angular zone (https://github.com/Enngage/ngx-captcha/issues/26) --- .../src/lib/components/base-recaptcha.component.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/projects/ngx-captcha-lib/src/lib/components/base-recaptcha.component.ts b/projects/ngx-captcha-lib/src/lib/components/base-recaptcha.component.ts index 13e2ab5..2fa1b75 100644 --- a/projects/ngx-captcha-lib/src/lib/components/base-recaptcha.component.ts +++ b/projects/ngx-captcha-lib/src/lib/components/base-recaptcha.component.ts @@ -205,8 +205,13 @@ export abstract class BaseReCaptchaComponent implements OnChanges, ControlValueA * Responsible for instantiating captcha element */ protected renderReCaptcha(): void { - this.captchaId = this.reCaptchaApi.render(this.captchaElemId, this.getCaptchaProperties()); - this.ready.next(); + + // run outside angular zone due to timeout issues when testing + // details: https://github.com/Enngage/ngx-captcha/issues/26 + this.zone.runOutsideAngular(() => { + this.captchaId = this.reCaptchaApi.render(this.captchaElemId, this.getCaptchaProperties()); + this.ready.next(); + }); } /**