Bird
0
0

In a reactive form, how can you reset the form to its initial state including clearing validation errors after submission?

hard🚀 Application Q9 of 15
Angular - Template-Driven Forms
In a reactive form, how can you reset the form to its initial state including clearing validation errors after submission?
ARecreate the form group manually
BCall <code>this.form.clear()</code>
CSet each control value to empty string manually
DCall <code>this.form.reset()</code>
Step-by-Step Solution
Solution:
  1. Step 1: Understand form reset method

    this.form.reset() resets all controls to initial values and clears validation states.

  2. Step 2: Compare with other options

    clear() does not exist; recreating or manual clearing is inefficient.

  3. Final Answer:

    Call this.form.reset() -> Option D
  4. Quick Check:

    Reset form with form.reset() method [OK]
Quick Trick: Use form.reset() to clear values and validation [OK]
Common Mistakes:
MISTAKES
  • Trying to clear form manually instead of reset()
  • Using non-existent clear() method

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes