Angular Reactive forms : how to reset form state and keep values after submit

The solution of @smnbbrv works pretty well.

You can also provide your actual form value to reset() method.

Given the fact myReactiveForm is a Reactive form in your component. After successful submit of your form (by calling a service for example), then your can do:

this.myReactiveForm.reset(this.myReactiveForm.value);

It will reset the form and set the “new” form values to the same value you form had.

This method can be see within Tour of Hero example Official Angular.io doc

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)