angular formbuilder tutorial code example
Example: formbuilder angular example
this.contactForm = this.formBuilder.group({
firstname: ['', [Validators.required, Validators.minLength(10)]],
lastname: ['', [Validators.required, Validators.maxLength(15), Validators.pattern("^[a-zA-Z]+$")]],
email: ['', [Validators.required, Validators.email]],
gender: ['', [Validators.required]],
isMarried: ['', [Validators.required]],
country: ['', [Validators.required]],
address: this.formBuilder.group({
city: ['', [Validators.required]],
street: ['', [Validators.required]],
pincode: ['', [Validators.required]],
})
});