File

src/app/_helpers/custom-error-state-matcher.ts

Implements

ErrorStateMatcher

Index

Methods

Methods

isErrorState
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null)
Parameters :
Name Type Optional
control FormControl | null No
form FormGroupDirective | NgForm | null No
Returns : boolean
import {ErrorStateMatcher} from '@angular/material/core';
import {FormControl, FormGroupDirective, NgForm} from '@angular/forms';

export class CustomErrorStateMatcher implements ErrorStateMatcher{
  isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
    const isSubmitted: boolean = form && form.submitted;
    return !!(control && control.invalid && (control.dirty || control.touched || isSubmitted));
  }
}

result-matching ""

    No results matching ""