Bird
0
0

What does a custom validator function in Angular return when the input is valid?

easy🧠 Conceptual Q11 of 15
Angular - Reactive Forms
What does a custom validator function in Angular return when the input is valid?
Aan empty string
Btrue
Cfalse
Dnull
Step-by-Step Solution
Solution:
  1. Step 1: Understand Angular validator return values

    Angular custom validators return null when the input passes validation, meaning no errors.
  2. Step 2: Identify the valid return for no errors

    Returning null signals the form control is valid, while any object means invalid.
  3. Final Answer:

    null -> Option D
  4. Quick Check:

    Valid input returns null [OK]
Quick Trick: Valid inputs always return null from validators [OK]
Common Mistakes:
MISTAKES
  • Returning true or false instead of null or error object
  • Returning empty string instead of null
  • Confusing valid with invalid return values

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes