skip to Main Content

Html – Phone Number Validator In Angular

I want these type format and extension number are optional (1800)-555-1212 X 65432 HTML: <input type="text" placeholder="Phone" min="10" max="15" class="form-control" formControlName="phone" mask="(000)-000-0000 x 00000" [ngClass]="{ 'is-invalid': (isSaved && contactForm.phone.errors)}"> Typescript: phone: ['', [Validators.pattern(this.commonRegex.PhoneWithExtRegex)]], /(?([0-9]{3}))?([ .-]?)([0-9]{3})2([0-9]{4})+x([0-4]{5})/

VIEW QUESTION
Back To Top
Search