From 52af7b3472e6130138dd7fc2c3dc5776fcc90bfd Mon Sep 17 00:00:00 2001 From: Dimitrios Kordas Date: Sat, 13 Aug 2016 14:11:09 +0300 Subject: [PATCH] Invoking event emitter with data instead of just true. --- directives/googlerecaptcha.directive.ts | 92 ++++++++++++------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/directives/googlerecaptcha.directive.ts b/directives/googlerecaptcha.directive.ts index 7579e03..0412d5c 100644 --- a/directives/googlerecaptcha.directive.ts +++ b/directives/googlerecaptcha.directive.ts @@ -1,47 +1,47 @@ -import {Directive, ElementRef, EventEmitter, Input,Output, OnInit} from '@angular/core'; -import {NgModel} from '@angular/common'; - -declare var grecaptcha: any; - -@Directive({ - selector: '[googlerecaptcha]', - providers: [NgModel], - host: { - '(input)' : 'onInputChange()' - } -}) -export class GoogleRecaptchaDirective implements OnInit { - @Input('theme') theme:string = ''; - @Input('siteKey') siteKey:string; - @Output('setVerified') setVerified: EventEmitter = new EventEmitter(); - modelValue:any; - private _el:HTMLElement; - - - - constructor(el: ElementRef,private model:NgModel) { - this._el = el.nativeElement; - this.modelValue = this.model; - var input = this._el; - - } - - ngOnInit() { - setTimeout(() =>{ - grecaptcha.render(this._el, { - 'sitekey' : this.siteKey, - 'callback' : (data) => { - if(data) { - this.setVerified.emit(true); - } - }, - 'theme' : this.theme - }); - },1000) - - }; - - - onInputChange() { - } +import {Directive, ElementRef, EventEmitter, Input,Output, OnInit} from '@angular/core'; +import {NgModel} from '@angular/common'; + +declare var grecaptcha: any; + +@Directive({ + selector: '[googlerecaptcha]', + providers: [NgModel], + host: { + '(input)' : 'onInputChange()' + } +}) +export class GoogleRecaptchaDirective implements OnInit { + @Input('theme') theme:string = ''; + @Input('siteKey') siteKey:string; + @Output('setVerified') setVerified: EventEmitter = new EventEmitter(); + modelValue:any; + private _el:HTMLElement; + + + + constructor(el: ElementRef,private model:NgModel) { + this._el = el.nativeElement; + this.modelValue = this.model; + var input = this._el; + + } + + ngOnInit() { + setTimeout(() =>{ + grecaptcha.render(this._el, { + 'sitekey' : this.siteKey, + 'callback' : (data) => { + if(data) { + this.setVerified.emit(data); + } + }, + 'theme' : this.theme + }); + },1000) + + }; + + + onInputChange() { + } } \ No newline at end of file