Created
September 2, 2017 06:27
-
-
Save alexonozor/76e93fe9eba5e5c85a031b216b443af0 to your computer and use it in GitHub Desktop.
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
const userForm = new FormGroup({ | |
userName: new FormControl('', [ | |
Validators.required, | |
Validators.minLength(2), | |
forbiddenNameValidator(/bob/i) // <-- Here's how you pass in the custom validator. | |
]), | |
firstName: new FormControl('', [ Validators.required, Validators.minLength(2)]), | |
lastName: new FormControl(''), | |
address: new FormGroup({ | |
street: new FormControl('', Validators.required), | |
city: new FormControl(''), | |
zipCode: new FormControl('') | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment