openaire-library/contact-us/contact-us.component.ts

40 lines
983 B
TypeScript

import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {FormGroup} from '@angular/forms';
import {EnvProperties} from "../utils/properties/env-properties";
@Component({
selector: 'contact-us',
templateUrl: './contact-us.component.html',
})
export class ContactUsComponent implements OnInit {
@Input()
public contactForm: FormGroup;
@Input() formTitle: string;
@Input() properties: EnvProperties;
@Output() sendEmitter: EventEmitter<any> = new EventEmitter<any>();
@Output() resetEmitter: EventEmitter<any> = new EventEmitter<any>();
@Input() errorMessage;
constructor() {
}
ngOnInit() {
}
public send() {
this.sendEmitter.emit({
valid: this.contactForm.valid
});
}
public reset() {
this.resetEmitter.emit();
}
public handleRecaptcha(captchaResponse: string) {
this.contactForm.get('recaptcha').setValue(captchaResponse);
}
}