feat: contact form group generator class

This commit is contained in:
2025-12-14 20:12:49 -03:00
parent c501d9aada
commit dfdeeb4d57
2 changed files with 21 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
import { FormGroupContact } from './form-group-contact';
fdescribe('FormGroupContact', () => {
it('should create an instance', () => {
expect(new FormGroupContact()).toBeTruthy();
});
});

View File

@@ -0,0 +1,14 @@
import { FormControl, FormGroup, Validators } from "@angular/forms";
export class FormGroupContact extends FormGroup{
constructor(name: FormValue = null, company: FormValue = null, phone: FormValue = null) {
super({
name: new FormControl(name, [Validators.required, Validators.maxLength(55)]),
company: new FormControl(company, [Validators.required, Validators.maxLength(55)]),
phone: new FormControl(phone, [Validators.required, Validators.pattern( /^(\+?[\d]){12,15}$/ )]),
});
}
}
type FormValue = string| null;