Skip to main content

What is the valid and invalid state?

valid and invalid are states that show whether a field (or the whole form) has passed validator checks.

  • valid - all applied validators pass successfully, there are no errors.
  • invalid - at least one validator returned an error.

Example:

typescript
email = new FormControl('', [Validators.required, Validators.email]);

If the field is empty: invalid, if a correct address is entered: valid.

These states are used to control interface logic: for example, disabling the "Submit" button while the form is invalid.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.