Last active
August 21, 2019 14:24
-
-
Save LuizCostaa/7da68013f791886d418a1246d91ca87d to your computer and use it in GitHub Desktop.
Empty validator to reactive form control
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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