Search code examples
angularangular-forms

Which is a best practice to use `reset()` and `resetForm()` methods in angular and why?


I am using Template driven form in my application. When i'am submitting the form then that time i have use reset method.
I have found another formReset() method, i have check both method they work as same
For Angular best practice which method is useful to use? and how?


Solution

  • In a Model driven form to reset the form we just need to call the function reset() on our model for to resets all the input fields to go back to their initial state.

    similarly To reset form in template driven form, NgForm has resetForm() method to reset the form.

    I hope this will be useful.