Bird
0
0

What will be the validity of this FormControl?

medium📝 Predict Output Q5 of 15
Angular - Reactive Forms
What will be the validity of this FormControl?
const control = new FormControl('12345', [Validators.minLength(6)]);
console.log(control.valid);
Atrue
Bnull
Cfalse
DError
Step-by-Step Solution
Solution:
  1. Step 1: Understand minLength validator

    Validators.minLength(6) requires input length to be at least 6 characters.
  2. Step 2: Check input length

    Input '12345' has length 5, which is less than 6.
  3. Final Answer:

    false -> Option C
  4. Quick Check:

    Input length < minLength = invalid [OK]
Quick Trick: minLength fails if input shorter than limit [OK]
Common Mistakes:
MISTAKES
  • Assuming equal length passes
  • Ignoring length check
  • Expecting true for shorter input

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes