Skip to content

Commit

Permalink
fix(component): use ElementRef to access component's native element
Browse files Browse the repository at this point in the history
Closes #48, #68
  • Loading branch information
Ivan Pankratov authored and DethAriel committed Dec 26, 2017
1 parent fd7e063 commit d3a8409
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion recaptcha/recaptcha.component.ts
@@ -1,6 +1,7 @@
import {
AfterViewInit,
Component,
ElementRef,
EventEmitter,
HostBinding,
Inject,
Expand Down Expand Up @@ -44,6 +45,7 @@ export class RecaptchaComponent implements AfterViewInit, OnDestroy {
private grecaptcha: ReCaptchaV2.ReCaptcha;

constructor(
private elementRef: ElementRef,
private loader: RecaptchaLoaderService,
private zone: NgZone,
@Optional() @Inject(RECAPTCHA_SETTINGS) settings?: RecaptchaSettings,
Expand Down Expand Up @@ -121,7 +123,7 @@ export class RecaptchaComponent implements AfterViewInit, OnDestroy {

/** @internal */
private renderRecaptcha() {
this.widget = this.grecaptcha.render(this.id, {
this.widget = this.grecaptcha.render(this.elementRef.nativeElement, {
badge: this.badge,
callback: (response: string) => {
this.zone.run(() => this.captchaReponseCallback(response));
Expand Down

0 comments on commit d3a8409

Please sign in to comment.