Bird
0
0

You want to disable the submit button until the form is valid and the user has touched all controls. Which Angular form state checks should you combine?

hard📝 state output Q8 of 15
Angular - Reactive Forms
You want to disable the submit button until the form is valid and the user has touched all controls. Which Angular form state checks should you combine?
Aform.pristine && form.valid
Bform.valid && form.dirty
Cform.valid && form.touched
Dform.valid && all controls touched
Step-by-Step Solution
Solution:
  1. Step 1: Understand form-level and control-level states

    Form's valid property indicates all controls pass validation. 'Touched' is per control, so you must check all controls touched.
  2. Step 2: Combine valid with all controls touched

    To ensure user interacted with all fields, check each control's touched state, not just form.touched (which may not exist).
  3. Final Answer:

    form.valid && all controls touched -> Option D
  4. Quick Check:

    Submit enabled when valid and all controls touched [OK]
Quick Trick: Check each control's touched, not just form.touched [OK]
Common Mistakes:
MISTAKES
  • Using form.touched which is not a form property
  • Confusing dirty with touched
  • Checking pristine instead of touched

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes