Skip to content

Instantly share code, notes, and snippets.

@LuizCostaa
Last active August 21, 2019 14:24
Show Gist options
  • Save LuizCostaa/7da68013f791886d418a1246d91ca87d to your computer and use it in GitHub Desktop.
Save LuizCostaa/7da68013f791886d418a1246d91ca87d to your computer and use it in GitHub Desktop.
Empty validator to reactive form control
import { AbstractControl, ValidationErrors } from '@angular/forms';
public customIsEmpty(control: AbstractControl): ValidationErrors {
if (control.value.trim().length === 0) {
return {isEmpty: true};
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment