Skip to content

Commit 37b6d9f

Browse files
committed
Pattern validation
1 parent a6aad58 commit 37b6d9f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

template-driven-forms/src/app/app.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ <h2>Bootcamp Enrollment Form</h2>
1515

1616
<div class="form-group">
1717
<label>Phone</label>
18-
<input type="tel" class="form-control" name="phone" [(ngModel)]="userModel.phone">
18+
<input type="tel" #phone="ngModel" pattern="^\d{10}$" class="form-control" [class.is-invalid]="phone.invalid && phone.touched" name="phone" [(ngModel)]="userModel.phone">
1919
</div>
2020

2121
<div class="form-group">

0 commit comments

Comments
 (0)