import { Component, OnInit, Output, EventEmitter } from '@angular/core'; import {FormGroup, FormBuilder, Validators, AbstractControl} from '@angular/forms'; @Component({ selector: 'of-member-reset-password', templateUrl: './member-reset-password.component.html', }) export class MemberResetPasswordComponent implements OnInit { @Output() resetPassword = new EventEmitter(); resetPasswordForm: FormGroup; email: AbstractControl; constructor( private formBuilder: FormBuilder ) { } ngOnInit() { this.resetPasswordForm = this.formBuilder.group({ 'email': ['', [ Validators.required, Validators.email ] ] }); this.email = this.resetPasswordForm.controls['email']; } resetPasswordFormSubmit() { const formValue = Object.assign({}, this.resetPasswordForm.value); this.resetPassword.emit(formValue.email); } }