Last active
December 18, 2023 19:37
-
-
Save andrewarosario/90bfe581cb73d688655e27050b696041 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 { FormControl, ValidationErrors } from '@angular/forms'; | |
export function trimmedRequiredValidator(control: FormControl<string>): ValidationErrors | null { | |
return !control.value || (control.value && control.value.trim() == '') ? { required: true } : null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment