1

I am trying to make reactive form custom validation, From multiple set of inputs [text-boxes, radio button, select], Form get validated with true when any two input fields are filled or entered.

1 Answer 1

1

For custom validation in form , you can set flag by check form control value in if condition and display message in HTML with that flag.

Example:

In the TS file:

flag:boolean;
if(this.demoForm.value.phone && this.demoForm.value.pin){
   this.flag=false;
}else{
   this.flag=true
}

In HTML file:

<span *ngIf='flag'>Your form is invalid</span>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.