Answers for "reactive form validation in angular 7"

1

angular validators number only in reactive form

new FormControl({value: field.value}, [Validators.required, Validators.pattern(/^-?(0|[1-9]\d*)?$/)])
Posted by: Guest on October-24-2020
0

ng2 validations angular using reactiveforms

<form [formGroup]="form">
  <input type="password" formControlName="password"/>
  <p *ngIf="form.controls.password.errors?.required">required error</p>
  <input type="password" formControlName="certainPassword"/>
  <p *ngIf="form.controls.certainPassword.errors?.equalTo">equalTo error</p>
</form>
Posted by: Guest on September-23-2020
2

formgroup check if valid

form: FormGroup;

onSubmit(){
    //checks if form is valid
       if( this.form.valid){
          //more code here
        }
}
Posted by: Guest on July-31-2020

Code answers related to "reactive form validation in angular 7"

Code answers related to "Javascript"

Browse Popular Code Answers by Language