Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

angular 10 email id validation

<div class="form-group">
      <label for="email">Email: </label>
      <input type="email"  class="form-control" placeholder="Enter email" name="email" ngModel [email]="employee.emailId"  pattern="[a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,3}$" required #email ="ngModel"

      [class.is-invalid]= "email.invalid && email.touched " >

      <div *ngIf="email.errors && (email.dirty && email.touched)" class="alert-email alert-danger-email"><br>

              <div [hidden]="!email.errors['pattern']">
                Please input a valid email.
              </div>
              <div [hidden]="!email.errors['required']">
                Email is required
              </div>

            </div>

    </div>
 
PREVIOUS NEXT
Tagged: #angular #email #id #validation
ADD COMMENT
Topic
Name
3+4 =