Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

angular validation on numbers

form [formGroup]="registerForm" (ngSubmit)="onSubmit()"
div class="col-md-4"
  div class="form-group"
    label for="">YOUR PHONE NUMBER /label
    input (keypress)="keyPress($event)" required type="text" formControlName="phonenumber" class="form-control" placeholder="Enter Your phone Number" [ngClass]="{ 'is-invalid': submitted && f.phonenumber.errors }"
    div ngIf="submitted && f.phonenumber.errors" class="invalid-feedback"
    div ngIf="f.phonenumber.errors.required">Phone number is required /div
    div *ngIf="f.phonenumber.errors.pattern || f.phonenumber.errors.maxlength || f.phonenumber.errors.minlength">Phone number must be at least 10 numbers /div
    /div
    /div
  /div
input type="submit" class="mw-ui-btn" value="Submit"
/form
Source by www.abstractapi.com #
 
PREVIOUS NEXT
Tagged: #angular #validation #numbers
ADD COMMENT
Topic
Name
2+2 =