Resetting a form in Angular 2 after submit

前端 未结 12 1955
悲哀的现实
悲哀的现实 2020-12-01 03:16

I am aware that Angular 2 currently lacks a way to easily reset a form to a pristine state. Poking around I have found a solution like the one below that resets the form f

12条回答
  •  遥遥无期
    2020-12-01 03:42

    I don't know if I'm on the right path, but I got it working on ng 2.4.8 with the following form/submit tags:

    Seems to do the trick and sets the form's fields to "pristine" again.

提交回复
热议问题