import { Component, OnInit } from '@angular/core'; import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import {CustomErrorStateMatcher} from '@app/_helpers'; @Component({ selector: 'app-invite', templateUrl: './invite.component.html', styleUrls: ['./invite.component.scss'] }) export class InviteComponent implements OnInit { inviteForm: FormGroup; submitted: boolean = false; matcher = new CustomErrorStateMatcher(); constructor( private formBuilder: FormBuilder ) { } ngOnInit(): void { this.inviteForm = this.formBuilder.group({ email: ['', Validators.required], role: ['', Validators.required] }); } get inviteFormStub(): any { return this.inviteForm.controls; } invite(): void { this.submitted = true; if (this.inviteForm.invalid) { return; } this.submitted = false; } }