Bird
0
0

Given this form control:

medium📝 state output Q13 of 15
Angular - Reactive Forms
Given this form control:
new FormControl('', [Validators.required, Validators.minLength(3)])

What will be the validation status if the user enters 'Hi'?
AValid
BInvalid because input is empty
CInvalid because input does not match pattern
DInvalid because input length is less than 3
Step-by-Step Solution
Solution:
  1. Step 1: Check input against Validators.required

    The input 'Hi' is not empty, so the required validator passes.
  2. Step 2: Check input length against Validators.minLength(3)

    'Hi' has length 2, which is less than 3, so minLength validator fails.
  3. Final Answer:

    Invalid because input length is less than 3 -> Option D
  4. Quick Check:

    Length 2 < 3 = Invalid minLength [OK]
Quick Trick: Check required first, then minLength [OK]
Common Mistakes:
MISTAKES
  • Assuming 'Hi' is valid because not empty
  • Ignoring minLength validator
  • Confusing pattern validator presence

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes